-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
56 lines (56 loc) · 1.46 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
let webpack = require('webpack');
let path = require('path');
module.exports = {
devtool:"sourcemap",
watch:true,
entry:{
//webpack dev server bug
worker:['./class/worker.js'],
dest:['webpack-dev-server/client?http://localhost:8080/','babel-polyfill','./default.js']
},
devServer: {
contentBase: path.join(__dirname, "dest"),
compress: true,
port: 8080
},
output:{
path:path.join(__dirname, "dest"),
filename:"[name].js"
},
module:{
loaders:[{
test: /\.js|jsx$/,
exclude: /(node_modules|bower_components)/,
loader: "babel-loader",
query: {
presets: ['es2015', 'stage-3'],
compact:true,
ignore:[
'harrJson.js']
// sourceMaps: ['both']//babel的sourcemap
}
},{
test:/\.html$/,
loader: 'html-loader',
query: {
minimize: true
}
},{
test: /\.jpg$/, loader: "file-loader"
},
{
test: /\.png$/, loader: "url-loader?mimetype=image/png"
}]
},
plugins:[
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
_ENV_DEV:JSON.stringify(true)// we can judge environment in source code
}),
// new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
// })
]
}