-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
56 lines (52 loc) · 1.39 KB
/
webpack.config.js
File metadata and controls
56 lines (52 loc) · 1.39 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
var path = require('path');
var webpack = require('webpack');
const config = {
entry: ['./components/index.jsx'],
output: {
path: path.resolve(__dirname, 'public/scripts'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /.jsx?$/,
loaders: ['babel-loader?{"presets":["es2015","react"]}'],
exclude: /node_modules/
}
]
},
resolveLoader: {
root: [
path.join(__dirname, 'node_modules'),
],
},
resolve: {
root: [
path.join(__dirname, 'node_modules'),
],
},
devtool: '#inline-source-map'
// plugins: [
// new webpack.DefinePlugin({ // <-- Key to reducing React's size
// 'process.env': {
// 'NODE_ENV': JSON.stringify('production')
// }
// }),
// new webpack.optimize.DedupePlugin(), // Dedupe similar code
// new webpack.optimize.UglifyJsPlugin(), // Minify everything
// new webpack.optimize.AggressiveMergingPlugin() // Merge chunks
// ]
};
if (process.env.NODE_ENV !== 'prod') {
config.entry.unshift(
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000',
'webpack/hot/only-dev-server'
);
config.module.loaders[0].loaders.unshift('react-hot');
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
];
}
module.exports = config;