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", "start-dev": "npm-run-all --parallel watch start",
"build": "npm-run-all build:*", "build": "npm-run-all build:*",
"build:font-awesome": "node scripts/build-fontawesome.js", "build:font-awesome": "node scripts/build-fontawesome.js",
"build:webpack": "webpack", "build:webpack": "webpack -p",
"watch": "webpack -w", "watch": "webpack -d --watch",
"test": "npm-run-all -c test:* lint", "test": "npm-run-all -c test:* lint",
"test:mocha": "mocha", "test:mocha": "mocha",
"lint": "npm-run-all -c lint:*", "lint": "npm-run-all -c lint:*",

View file

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