using NODE_ENV=development npm run build:dll to build a dev dll

This commit is contained in:
zema1 2017-11-26 16:05:31 +08:00
parent 3b41ab15fc
commit b050291911
3 changed files with 10 additions and 2 deletions

View File

@ -62,7 +62,7 @@ Modern browsers and Internet Explorer 10+.
```bash
# we use webpack DllReference to decrease the build time,
# this command only needs execute once unless you upgrade the package in build/webpack.dll.conf.js
npm run build:dll
NODE_ENV=development npm run build:dll
# the dev-server will set proxy table to your backend
export TARGET=http://Your-backend

View File

@ -70,3 +70,8 @@ exports.styleLoaders = function (options) {
}
return output
}
exports.getNodeEnv = function () {
const NODE_ENV = process.env.NODE_ENV
return NODE_ENV ? NODE_ENV: 'production'
}

View File

@ -2,6 +2,9 @@ const webpack = require('webpack');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const config = require('../config')
const utils = require('./utils')
const NODE_ENV = utils.getNodeEnv()
const vendors = [
'vue/dist/vue.esm.js',
@ -25,7 +28,7 @@ module.exports = {
},
plugins: [
new webpack.DefinePlugin({
'process.env': config.build.env
'process.env': NODE_ENV === 'production' ? config.build.env : config.dev.env
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /zh-cn/),