fixed webpack optimization

This commit is contained in:
xdrm-brackets 2018-02-22 14:26:07 +01:00
parent 70d0ce8143
commit 633fc36aeb
2 changed files with 13 additions and 12 deletions

View File

@ -6,15 +6,15 @@
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {
"build:clean": "rm ./public_html/js/bundle/*.js*; exit 0", "bundle:clean": "rm ./public_html/js/bundle/*.js*; exit 0",
"build:bundle": "cross-env NODE_ENV=production webpack --progress --hide-modules", "bundle:prod": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"build:dev": "cross-env NODE_ENV=development webpack --progress --hide-modules", "bundle:dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
"build:dev-watch": "cross-env NODE_ENV=development webpack --progress --watch --hide-modules", "bundle:watch": "cross-env NODE_ENV=development webpack --progress --watch --hide-modules",
"scss": "node-sass -r --output-style compressed --output ./public_html/css ./webpack/scss", "scss": "node-sass -r --output-style compressed --output ./public_html/css ./webpack/scss",
"watch-css": "node-sass -w -r --output-style compressed --output ./public_html/css ./webpack/scss", "watch-css": "node-sass -w -r --output-style compressed --output ./public_html/css ./webpack/scss",
"dev": "npm run build:clean; npm run build:dev; npm run watch-css", "dev": "npm run bundle:clean; npm run bundle:dev; npm run watch-css",
"devjs": "npm run build:clean; npm run build:dev-watch", "devjs": "npm run bundle:clean; npm run bundle:watch",
"build": "npm run build:clean; npm run build:bundle; npm run scss" "build": "npm run bundle:clean; npm run bundle:prod;"
}, },
"dependencies": { "dependencies": {
"vue": "^2.5.9" "vue": "^2.5.9"

View File

@ -46,7 +46,7 @@ module.exports = [ {
filename: 'home@0.js' filename: 'home@0.js'
}, },
module: mod_common, module: mod_common,
devtool: '#eval-source-map' devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false
}, { }, {
@ -58,14 +58,14 @@ module.exports = [ {
filename: 'login@0.js' filename: 'login@0.js'
}, },
module: mod_common, module: mod_common,
devtool: '#eval-source-map' devtool: (process.env.NODE_ENV==='development') ? '#eval-source-map' : false
} ] } ]
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html // http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([ module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
@ -83,4 +83,5 @@ if (process.env.NODE_ENV === 'production') {
minimize: true minimize: true
}) })
]) ])
} }