-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.prod.js
55 lines (50 loc) · 1.3 KB
/
webpack.config.prod.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
const webpack = require('webpack');
module.exports = {
entry: [
'./src/index.js',
],
output: {
path: __dirname + '/dist',
filename: 'bundle.min.js',
},
resolve: {
modulesDirectories: ['node_modules', './src'],
extensions: ['', '.web.js', '.json', '.js', '.jsx'],
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0', 'react'],
plugins: [['antd', {'style': true, libraryName: 'antd-mobile'}]],
},
exclude: /node_modules/,
}, {
test: /\.css$/,
loader: 'style!css',
}, {
test: /\.less$/,
loader: 'style!css!less',
}, {
test: /\.(png|jpg|svg)$/,
loader: 'url?limit=25000',
},
],
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {warnings: false},
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
__DEV__: JSON.stringify(JSON.parse(process.env.NODE_ENV === 'production' ? 'false' : 'true')),
}),
],
};