[HMR] Hot Module Replacement is disabled.

webpack配置

let path = require('path');
let htmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');

module.exports = {
    entry: './main.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    mode: 'development',
    devtool: 'inline-source-map',
    devServer: {
        contentBase: './dist',
        hot: true
    },
    plugins: [
        new htmlWebpackPlugin(),
        new CleanWebpackPlugin(['dist']),
        new webpack.NamedModulesPlugin(),
        new webpack.HotModuleReplacementPlugin()
    ]
}

一切都是安装文档配置,结果报了个错: [HMR] Hot Module Replacement is disabled.
查了stackoverflow,需要在启动的时候加上下面这一句

--hot --inline
package.json配置如下:
"start": "webpack-dev-server --hot --inline --open"

你可能感兴趣的:([HMR] Hot Module Replacement is disabled.)