Do not uglify builds when running start-dev

This commit is contained in:
Pavel Djundik 2016-12-30 13:20:44 +02:00 committed by Jérémie Astori
parent 0d8b58425e
commit a8dd136168
2 changed files with 21 additions and 16 deletions

View file

@ -17,8 +17,8 @@
"start-dev": "npm-run-all --parallel watch start",
"build": "npm-run-all build:*",
"build:font-awesome": "node scripts/build-fontawesome.js",
"build:webpack": "webpack",
"watch": "webpack -w",
"build:webpack": "webpack -p",
"watch": "webpack -d --watch",
"test": "npm-run-all -c test:* lint",
"test:mocha": "mocha",
"lint": "npm-run-all -c lint:*",

View file

@ -2,11 +2,12 @@
const webpack = require("webpack");
const path = require("path");
const isWatch = process.argv.includes("--watch");
module.exports = {
let config = {
entry: {
app: path.resolve(__dirname, "client/js/lounge.js"),
vendor: [
"js/bundle.js": path.resolve(__dirname, "client/js/lounge.js"),
"js/bundle.vendor.js": [
"handlebars/runtime",
"jquery",
"jquery-ui/ui/widgets/sortable",
@ -17,8 +18,8 @@ module.exports = {
},
devtool: "source-map",
output: {
path: path.resolve(__dirname, "client/js"),
filename: "bundle.js",
path: path.resolve(__dirname, "client"),
filename: "[name]",
publicPath: "/"
},
module: {
@ -53,14 +54,18 @@ module.exports = {
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin(
"vendor", // chunkName
"bundle.vendor.js" // filename
),
new webpack.optimize.UglifyJsPlugin({
new webpack.optimize.DedupePlugin(),
new webpack.optimize.CommonsChunkPlugin("js/bundle.vendor.js"),
]
};
if (!isWatch) {
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
comments: false,
compress: {
warnings: false
}
}),
]
};
}));
}
module.exports = config;