-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.production.config.js
72 lines (70 loc) · 2.03 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
67
68
69
70
71
72
var path = require('path'),
webpack = require('webpack'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
HtmlWebpackPlugin = require('html-webpack-plugin'),
AssetsPlugin = require('assets-webpack-plugin');
var config = {
entry: {
app: path.join(__dirname, 'app/main'),
vendor: ['jquery', 'backbone', 'biz-ui']
},
output: {
path: path.join(__dirname, 'public'),
filename: 'app.[chunkhash].js',
chunkFilename: '[name].[chunkhash].js',
publicPath: '/public/',
jsonpFunction: 'ricky'
},
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url?limit=10000'
},
{
test: /\.html$/,
loader: 'mustache'
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=]+)?$/,
loader: 'file-loader'
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.[chunkhash].js'
}),
// https://github.com/webpack/webpack/issues/1315
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
filename: 'manifest.[chunkhash].js',
chunks: ['vendor']
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
bizui: 'biz-ui',
Backbone: 'backbone'
}),
new ExtractTextPlugin('[name].[chunkhash].css'),
new HtmlWebpackPlugin({
filename: '../index.jsp',
template: 'asset/tpl/index.html'
}),
new AssetsPlugin({
prettyPrint: true
})
]
};
module.exports = config;