[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"
目录
相关文章
|
3月前
ESLint—— Failed to load config "standard" to extend from
ESLint—— Failed to load config "standard" to extend from
73 0
|
4月前
|
JavaScript
Component name “header“ should always be multi-word
Component name “header“ should always be multi-word
|
6月前
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.
73 2
|
6月前
|
JavaScript 前端开发
ESLint—— Failed to load config “standard“ to extend from
ESLint—— Failed to load config “standard“ to extend from
170 0
|
6月前
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
106 0
|
6月前
|
Serverless Python
No module named lama_cleaner
No module named lama_cleaner
120 1
|
11月前
|
JavaScript
解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法
解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法
Custom directive is missing corresponding SSR transform and will be ignored.
Custom directive is missing corresponding SSR transform and will be ignored.
54 0
|
搜索推荐 索引
Term Suggester 中 suggest_mode 的三种模式missing、popular、always 的区别
Term Suggester 中 suggest_mode 的三种模式missing、popular、always 的区别
|
JavaScript 前端开发 编译器
什么是 Angular Ivy Partial compilation mode
什么是 Angular Ivy Partial compilation mode