-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.develop.js
More file actions
43 lines (41 loc) · 948 Bytes
/
Copy pathwebpack.develop.js
File metadata and controls
43 lines (41 loc) · 948 Bytes
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
const merge = require('webpack-merge');
const path = require('path');
const webpack = require('webpack');
const commonConfig = require('./webpack.config.js');
const OpenBrowserPlugin = require('open-browser-webpack-plugin');
const devConfig = {
devtool: 'inline-source-map',
entry: {
app: [
'react-hot-loader/patch',
path.join(__dirname, 'src/index.js')
]
},
output: {
filename: '[name].js'
},
devServer: {
contentBase: path.join(__dirname, './dist'),
historyApiFallback: true,
host: '0.0.0.0',
//代理
// proxy: {
// "/api": "http://localhost:3000"
// }
},
plugins: [
//浏览器打开localhost:8080页面
new OpenBrowserPlugin({
url: 'http://localhost:8080'
})
]
};
module.exports = merge({
customizeArray(a, b, key) {
/*替换entry.app*/
if (key === 'entry.app') {
return b;
}
return undefined;
}
})(commonConfig, devConfig);