[HMR] Hot Module Replacement is disabled.

简介: webpack配置let path = require('path');let htmlWebpackPlugin = require('html-webpack-plugin');const webpack = require('webpack...

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"
目录
相关文章
|
5月前
|
Python
ModuleNotFoundError: No module named ‘fake_useragent‘
这篇文章提供了解决`ModuleNotFoundError: No module named 'fake_useragent'`错误的多种方法,包括重新运行安装命令、根据Python版本号指定安装、更新模块到最新版本以及使用whl文件安装。
ModuleNotFoundError: No module named ‘fake_useragent‘
|
5月前
ESLint—— Failed to load config "standard" to extend from
ESLint—— Failed to load config "standard" to extend from
106 0
|
6月前
|
JavaScript 索引
Component name “index“ should always be multi-word vue/multi-word-component-names
Component name “index“ should always be multi-word vue/multi-word-component-names
|
8月前
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
91 2
|
8月前
|
JavaScript 前端开发
ESLint—— Failed to load config “standard“ to extend from
ESLint—— Failed to load config “standard“ to extend from
223 0
|
8月前
Classic mode for store/ is deprecated and will be removed in Nuxt 3
Classic mode for store/ is deprecated and will be removed in Nuxt 3
141 0
(node)Warning: Accessing non-existent property ‘xxx‘ of module exports inside circular depen
(node)Warning: Accessing non-existent property ‘xxx‘ of module exports inside circular depen
|
搜索推荐 索引
Term Suggester 中 suggest_mode 的三种模式missing、popular、always 的区别
Term Suggester 中 suggest_mode 的三种模式missing、popular、always 的区别
|
JavaScript 前端开发 开发者
Component name “xxx“ should always be multi-word
Component name “xxx“ should always be multi-word
Component name “xxx“ should always be multi-word
|
JSON 数据格式
ReferenceError: __dirname is not defined in ES module scope
ReferenceError: __dirname is not defined in ES module scope
625 0