Update to webpack 2

This commit is contained in:
Pavel Djundik 2017-02-17 17:01:20 +02:00
parent 00a3e3f14c
commit e0111ed587
2 changed files with 22 additions and 20 deletions

View file

@ -75,6 +75,6 @@
"socket.io-client": "1.7.2", "socket.io-client": "1.7.2",
"stylelint": "7.8.0", "stylelint": "7.8.0",
"urijs": "1.18.7", "urijs": "1.18.7",
"webpack": "1.14.0" "webpack": "2.2.1"
} }
} }

View file

@ -26,26 +26,29 @@ let config = {
publicPath: "/" publicPath: "/"
}, },
module: { module: {
loaders: [ rules: [
{ {
test: /\.js$/, test: /\.js$/,
include: [ include: [
path.resolve(__dirname, "client"), path.resolve(__dirname, "client"),
], ],
loader: "babel", use: {
query: { loader: "babel-loader",
options: {
presets: [ presets: [
"es2015" "es2015"
] ]
} }
}
}, },
{ {
test: /\.tpl$/, test: /\.tpl$/,
include: [ include: [
path.resolve(__dirname, "client/views"), path.resolve(__dirname, "client/views"),
], ],
use: {
loader: "handlebars-loader", loader: "handlebars-loader",
query: { options: {
helperDirs: [ helperDirs: [
path.resolve(__dirname, "client/js/libs/handlebars") path.resolve(__dirname, "client/js/libs/handlebars")
], ],
@ -53,6 +56,7 @@ let config = {
".tpl" ".tpl"
], ],
} }
}
}, },
] ]
}, },
@ -66,13 +70,11 @@ let config = {
// ********************************* // *********************************
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
config.plugins.push(new webpack.optimize.DedupePlugin());
config.plugins.push(new webpack.optimize.UglifyJsPlugin({ config.plugins.push(new webpack.optimize.UglifyJsPlugin({
comments: false, comments: false
compress: {
warnings: false
}
})); }));
} else {
console.log("Building in development mode, bundles will not be minified.");
} }
module.exports = config; module.exports = config;