-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
58 lines (56 loc) · 1.19 KB
/
webpack.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
var webpack = require('webpack'),
ExtractTextWebpackPlugin = require('extract-text-webpack-plugin'),
CopyWebpackPlugin = require('copy-webpack-plugin'),
HtmlWebpackPlugin = require('html-webpack-plugin');
var minify = process.env.ENV == 'prod'; //是否压缩
module.exports = {
entry : {
game : './src/js/game.js'
},
output : {
path : __dirname + '/dist',
filename : 'js/[name].js'
},
module : {
rules : [{
test : /\.css$/,
use : ExtractTextWebpackPlugin.extract({
use : [
'css-loader?-url&-reduceTransforms',
'postcss-loader'
]
})
}]
},
plugins : [
new webpack.BannerPlugin('v0.13'),
new ExtractTextWebpackPlugin('css/[name].css'),
new CopyWebpackPlugin([
{
from : './src/img',
to : 'img',
ignore : ['.gitkeep']
},{
from : './src/js/conf.js',
to : 'js'
},{
from : './src/js/app.bundle.js',
to : 'js/main.js'
},{
from : './src/plugin',
to : 'plugin',
ignore : ['.gitkeep']
}
]),
new HtmlWebpackPlugin({
inject : false,
minify : minify ? {
collapseWhitespace : true,
minifyCSS : true,
minifyJS : true,
removeComments : true
} : false,
template : './src/index.html'
})
]
};