-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.config.js
43 lines (38 loc) · 952 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
'use strict';
var webpack = require('webpack');
var path = require('path');
var config = {
entry: './lib/client/index.jsx',
output: {
path: path.join(__dirname, 'public/build'),
filename: 'build.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel?optional=runtime'
}
]
},
devtool: 'eval-source-map',
plugins: [
// don't emit a broken build when errors occur
new webpack.NoErrorsPlugin(),
// polyfill fetch
new webpack.ProvidePlugin({
fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch'
})
]
};
if (process.env.NODE_ENV === 'production') {
// disable sourcemaps in production
delete config.devtool;
// optimize in production
config.plugins = config.plugins.concat([
new webpack.optimize.UglifyJsPlugin({ mangle: false }),
new webpack.optimize.DedupePlugin()
]);
}
module.exports = config;