-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathwebpack.config.js
More file actions
54 lines (49 loc) · 1.06 KB
/
webpack.config.js
File metadata and controls
54 lines (49 loc) · 1.06 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
const path = require('path');
const webpack = require('webpack');
const NODE_ENV = process.env.NODE_ENV || 'development';
const DEV = NODE_ENV !== 'production';
const devE = [
'react-hot-loader/patch',
'./examples/onClick.jsx',
];
const prodE = {
main: './src/index.jsx',
vendors: ['react', 'react-dom'],
};
const minimize = new webpack.optimize.UglifyJsPlugin({
compress: { screw_ie8: true, warnings: false },
output: { comments: false },
sourceMap: false,
});
module.exports = {
devtool: 'eval-source-map',
entry: DEV ? devE : prodE,
output: {
path: __dirname,
filename: './dist/index.js',
},
resolve: {
extensions: ['.js', '.jsx'],
modules: [
'node_modules',
],
},
module: {
rules: [{
enforce: 'pre',
test: /\.jsx?$/,
loaders: 'eslint-loader',
exclude: '/node_modules/',
},
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /.css$/,
loader: 'style-loader!css-loader',
}],
},
plugins: !DEV ? [minimize] : [],
};