-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
60 lines (52 loc) · 1.16 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
52
53
54
55
56
57
58
59
60
'use strict';
const NODE_ENV = process.env.NODE_ENV || 'development';
const webpack = require('webpack');
const path = require('path');
module.exports = {
context: __dirname + '/frontend/js/',
entry: {
app: './main'
},
output: {
path: __dirname + '/public/js/',
filename: "common.js"
//filename: "common.[chunkhash].js"
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
watch: false,//NODE_ENV === 'development',
watchOptions: {
aggregateTimeout: 100
},
devtool: NODE_ENV === 'development' ? 'cheap-inline-module-source-map' : null,
plugins: [
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV)
}),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
}]
},
devServer: {
host: 'localhost', //default
port: '8080', // default
hot: true
}
};
if (NODE_ENV === 'production') {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
'drop_console': true,
unsafe: true
}
})
);
}