-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
46 lines (46 loc) · 1.15 KB
/
webpack.dev.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
const path = require('path')
const merge = require('webpack-merge')
const common = require('./webpack.common')
const OpenBrowserPlugin = require('open-browser-webpack-plugin')
const devConfig = {
devtool: 'inline-source-map',
entry: [
path.join(__dirname,'src/index.js')
]
,
output: {
filename: 'bundle.js'
},
module:{
rules:[{
test: /\.css$/,
use: ['style-loader','css-loader']
}]
},
devServer:{
contentBase: path.join(__dirname,'dist'),
// color: true, cli only
historyApiFallback: true,
host: "0.0.0.0",
port: 9000,
// progress: true, cli only 需要在命令行配置
proxy:{
'/api/':{
target: 'http://wandou.incubate.os',
changeOrigin: true
}
}
},
plugins:[
new OpenBrowserPlugin({ url: 'http://localhost:9000' })
]
}
module.exports = merge({
customizeObject(a, b, key) {
/*entry不合并,全替换*/
if (key === 'entry') {
return b;
}
return undefined;
}
})(common, devConfig);