forked from bmun/huxley
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (43 loc) · 940 Bytes
/
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
var path = require('path');
var webpack = require('webpack');
var JS_ROOT = path.join(__dirname, 'huxley/www/js');
var STATIC_ROOT = path.join(__dirname, 'huxley/www/static/js');
var plugins = [
new webpack.EnvironmentPlugin([
'NODE_ENV',
]),
];
if (process.env.NODE_ENV === 'production') {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
mangle: true,
})
);
}
module.exports = {
entry: path.join(JS_ROOT, 'entry.js'),
output: {
path: STATIC_ROOT,
filename: 'bundle.js',
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
plugins: ['transform-object-rest-spread'],
presets: ['es2015', 'es2017', 'react'],
},
},
],
},
plugins: plugins,
resolve: {
modulesDirectories: ['node_modules', JS_ROOT],
},
};