-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.production.config.js
66 lines (52 loc) · 1.4 KB
/
webpack.production.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 path = require('path');
var webpack = require('webpack');
var nodeModulesPath = path.resolve(__dirname, 'node_modules');
var config = {
entry : {
menu : path.resolve(__dirname, 'src/menu')
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
},
resolve: {
alias : {
//fix react
'react/lib': nodeModulesPath + 'react/lib',
'react' : nodeModulesPath + '/react/dist/react.min.js'
}
},
plugins: [
new webpack.DefinePlugin({
'__ENV__': JSON.stringify('production')
}),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.PrefetchPlugin('react'),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin(true),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel?stage=0'],//if use babel promise feature etc..?optional[]=runtime
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'autoprefixer?browsers=last 2 version', 'sass']
},
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url-loader?limit=10000' },
{ test: /\.(woff|woff2)$/, loader: 'url-loader?limit=100000' }
],
noParse: ['react']
}
};
module.exports = config;