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",
"private": true,
"scripts": {
"build:clean": "rm ./public_html/js/bundle/*.js*; exit 0",
"build:bundle": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"build:dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
"build:dev-watch": "cross-env NODE_ENV=development webpack --progress --watch --hide-modules",
"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",
"dev": "npm run build:clean; npm run build:dev; npm run watch-css",
"devjs": "npm run build:clean; npm run build:dev-watch",
"build": "npm run build:clean; npm run build:bundle; npm run scss"
"bundle:clean": "rm ./public_html/js/bundle/*.js*; exit 0",
"bundle:prod": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"bundle:dev": "cross-env NODE_ENV=development webpack --progress --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",
"watch-css": "node-sass -w -r --output-style compressed --output ./public_html/css ./webpack/scss",
"dev": "npm run bundle:clean; npm run bundle:dev; npm run watch-css",
"devjs": "npm run bundle:clean; npm run bundle:watch",
"build": "npm run bundle:clean; npm run bundle:prod;"
},
"dependencies": {
"vue": "^2.5.9"

View File

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