-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
35 lines (32 loc) · 1.35 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
/*
* @Description: 开发环境 webpack 配置
* @Author: Shie
* @Date: 2018-12-29
* @Last Modified by: Shie
* @Last Modified time: 2019-01-14 15:56:03
*/
const merge = require('webpack-merge');
const common = require('./webpack.common.js')
const webpack = require('webpack');
// const hotMiddlewareScript = 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true';
module.exports = merge(common, {
// entry: {
// app: './src/index.js',
// // // Add the client which connects to our middleware
// // // You can use full urls like 'webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr'
// // // useful if you run your app from another point like django
// // client: ['./src/index.js', hotMiddlewareScript]
// },
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
// https://blog.csdn.net/u013243347/article/details/85223016
disableHostCheck: true, // 为了浏览器能够自动刷新页面,新增该配置项:这是webpack本身出于安全考虑,因为不检查主机的应用程序容易受到DNS重新绑定攻击。但是,在我们的开发环境下,可以禁用掉disableHostCheck这一配置项。
hot: true
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
mode: "development"
});
console.log('process.env.NODE_ENV', process.env.NODE_ENV);