-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.production.config.js
58 lines (53 loc) · 1.63 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
/**
* Created by xudao on 16/12/26.
*/
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlFs = require('./webpackplugin/htmlfs.js');
var productionConfig = require('./webpackplugin/config');
new productionConfig({path: __dirname + "/app/main.js"});
module.exports = {
entry:{
index: __dirname + "/app/main.js",
vendor: ['react', 'react-dom', 'react-router', 'redux', 'react-redux', 'redux-thunk', 'swiper', 'react-addons-css-transition-group', 'react-tap-event-plugin']
},
output: {
path: __dirname + "/build",
filename: "[name].[chunkHash:8].js",
publicPath: '/',
chunkFilename: "[name].[chunkHash:8].js"
},
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("production")
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'manifest']
}),
new HtmlWebpackPlugin({
template: __dirname + "/build/index.html",
inject: true,
cache:true,
showErrors: false
}),
new HtmlFs({path: __dirname + "/build/", jsPath: __dirname + "/app/main.js"})
],
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.less$/,
loader: 'style-loader!css-loader!less-loader'
}
]
}
};