-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.prod.config.js
80 lines (80 loc) · 1.82 KB
/
webpack.prod.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var htmlWebpackPlugin=require('html-webpack-plugin');
var webpack=require('webpack');
var path=require('path');
module.exports={
entry:{
main:'./src/app.js',
},
output:{
path:path.resolve(__dirname,'lib'),
filename:'app.min.js',
library:'react-yui',
libraryTarget: 'umd',
publicPath: '/'
},
module:{
loaders:[
{
test:/\.js$/,
loader:'babel-loader',
exclude:path.resolve(__dirname,'node_modules'),
include:path.resolve(__dirname,'src'),
query:{
presets:['latest','stage-0', 'react']
}
},{
test:/\.tpl$/,
loader:'ejs-loader'
},
{
test:/\.css$/,
loader:'style-loader!css-loader?importLoaders=1!postcss-loader'
},{
test:/\.less$/,
loader:'style-loader!css-loader!postcss-loader!less-loader'
},{
test:/\.scss$/,
loader:'style-loader!css-loader!postcss-loader!sass-loader'
},{
test:/\.html$/,
loader:'html-loader'
},{
test:/\.(png|jpg|gif|svg)$/i,
loader:'file-loader',
query:{
name:'assets/[name]-[hash].[ext]'
}
},{
test: /\.(woff|woff2|eot|ttf|otf)$/,
loader:'file-loader',
query:{
name:'assets/[name]-[hash].[ext]'
}
},{
test: /\.(csv|tsv)$/,
loader:'csv-loader',
query:{
name:'assets/[name]-[hash].[ext]'
}
},{
test: /\.xml$/,
loader:'xml-loader',
query:{
name:'assets/[name]-[hash].[ext]'
}
}
]
},
externals: {
'react' : 'umd react',
'react-dom' : 'umd react-dom'
},
plugins:[
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
devtool:"cheap-module-source-map"
}