-
Notifications
You must be signed in to change notification settings - Fork 19
/
webpack.dev.config.js
43 lines (38 loc) · 1.14 KB
/
webpack.dev.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
var webpack = require('webpack')
var config = require('./webpack.base.config')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
config.devtool = 'source-map'
config.output.filename = '[name].[hash:8].js'
config.output.chunkFilename = '[name].[hash:8].js'
config.plugins = (config.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"dev"'
}
}),
//开发时css不打包到一个文件中,方便调试
new ExtractTextPlugin("styles.[hash:8].css",{allChunks: true}),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
filename: "[name].[hash:8].js",
minChunks: Infinity,
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new HtmlWebpackPlugin({
name:'index',
template: './src/index.html',
filename: 'index.html',
inject: 'body',
chunks: ['vendor', 'web_app'],
minify:{ //压缩HTML文件
removeComments:true, //移除HTML中的注释
collapseWhitespace:false //删除空白符与换行符
}
})
])
module.exports = config