-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
33 lines (31 loc) · 840 Bytes
/
webpack.dev.js
File metadata and controls
33 lines (31 loc) · 840 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
const webpack = require('webpack');
const merge = require('webpack-merge');
const path = require('path');
const common = require('./webpack.common.js');
const root = __dirname;
module.exports = merge(common, {
entry: [
'react-hot-loader/patch',
'webpack-dev-server/client',
'webpack/hot/only-dev-server',
path.resolve(root, 'src/index.js'),
],
output: {
filename: 'bundle.js',
path: path.resolve(root, 'dist'),
publicPath: '/',
},
devtool: 'inline-source-map',
devServer: {
hot: true, // 激活服务器的HMR
contentBase: './src/',
compress: true,
publicPath: '/',
port: 8000,
historyApiFallback: true,
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // 热替换插件
new webpack.NamedModulesPlugin(), // 执行热替换时打印模块名字
],
});