-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.conf.js
More file actions
62 lines (58 loc) · 1.4 KB
/
webpack.conf.js
File metadata and controls
62 lines (58 loc) · 1.4 KB
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
61
var webpack = require('webpack')
var isProd = process.env.NODE_ENV==='production'
var config = {
entry: {
script: './src/js/main.js',
vendor: ['moment','jquery','immutable','redux','react-redux','react-select']
},
output: {
path: './couchapp/_attachments/js',
filename: '[name].js'
},
externals: {
'react': 'React',
'react-dom': 'ReactDOM'
},
devtool: isProd ? 'cheap-eval' : 'eval',
module: {
loaders: [{
test: /\.js?$/,
exclude: /node_modules|__test__/,
loader: 'babel-loader',
query: {
"presets": ["es2015","react"]
}
}]
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en|il|ru)$/),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
//'NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}
}),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),
new webpack.DefinePlugin({
'isProd': isProd
})
]
}
if (isProd) {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
beautify: false,
comments: false,
compress: {
sequences : true,
booleans : true,
loops : true,
unused : true,
warnings : false,
drop_console: true,
unsafe : true
}
})
)
}
module.exports = config