-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
66 lines (63 loc) · 1.47 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
61
62
63
64
65
66
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: [
'./src/index.js'
],
devtool: 'source-map',
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js'
},
resolve: {
alias: {
tape: 'browser-tap',
sinon: 'sinon/pkg/sinon', // https://github.com/webpack/webpack/issues/177#issuecomment-185718237
},
extensions: ['', '.js', '.jsx']
},
module: {
noParse: [
/sinon/
],
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loaders: ['babel'],
}
]
},
// these are all enzyme specific
externals: {
'cheerio': 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
},
devServer: {
contentBase: "./public",
noInfo: true,
hot: true,
inline: true
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'dev')
}
})
]
};
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'ci') {
module.exports.entry.push('webpack-dev-server/client?http://0.0.0.0:8080');
module.exports.entry.push('webpack/hot/only-dev-server');
}
if (process.env.NODE_ENV === 'production') {
module.exports.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}))
}