-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
51 lines (48 loc) · 1.27 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var webpack = require("webpack");
var BrowserSyncPlugin = require("browser-sync-webpack-plugin");
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
var env = process.env.WEBPACK_ENV;
var plugins = [];
if (env === "build") {
// set NODE_ENV=production in environment,
// which ends up reducing size of React
plugins.push(
new webpack.DefinePlugin({
"process.env": { NODE_ENV: JSON.stringify("production") },
}),
);
// uglify code for production
plugins.push(new UglifyJsPlugin({ minimize: true }));
} else {
plugins.push(
new BrowserSyncPlugin({
host: "localhost",
port: 6001,
proxy: {
target: "http://localhost:5000",
ws: true,
},
serveStatic: [
{
route: "/static",
dir: "dlgr/griduniverse/static",
},
],
}),
);
}
module.exports = {
entry: {
bundle: "./dlgr/griduniverse/static/scripts/demo.js",
questionnaire: "./dlgr/griduniverse/static/scripts/questionnaire.js",
difi: "./dlgr/griduniverse/static/scripts/difi.js",
},
output: {
path: __dirname + "/dlgr/griduniverse/static",
filename: "scripts/dist/[name].js",
},
// use jquery from separate script tag
externals: { jquery: "jQuery" },
devtool: "source-map",
plugins: plugins,
};