-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
executable file
·63 lines (62 loc) · 1.41 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var webpack = require("webpack");
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
var CleanPlugin = require('clean-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry:"./src/app.js",
output:{
path:__dirname + "/dist",
filename: "bundle.js"
},
module:{
loaders:[
{
test:/\.(js|jsx)$/,
exclude:/node_modules/,
loader:"babel-loader",
query:{presets: [ 'es2015', 'react' ,'stage-0'] }
},
{
test:/\.css$|\.scss$/,
loader:"style-loader!css-loader!sass-loader"
},
{
test:/.(png|jpg|jpeg|gif)$/,
loader: 'url?limit=25000'
}
]
},
devServer:{
contentBase:"./virtual",
hot:true,
historyApiFallback: false,
port:8080,
inline: true, // Livereload
host: '0.0.0.0',
},
plugins: [
new CleanPlugin(['dist/*']),
new webpack.DefinePlugin({
//去掉react中的警告,react会自己判断
'process.env': {
NODE_ENV: '"production"'
}
}),
/* new HtmlWebpackPlugin({
template: './public/template.html',
htmlWebpackPlugin: {
"files": {
"css": ["style.css"],
"js": ["vendors.js","bundle.js"]
}
},
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
}
}),*/
new webpack.HotModuleReplacementPlugin()
//new OpenBrowserPlugin({url: 'http://127.0.0.1:8080/'})
]
}