Webpack - [HMR] Hot Module Replacement is disabled

Ater run npm run dev , http://localhost:8080/ there is nothing display in the browser and the console log show exception Hot Module Replacement is disabled

The solution:

In package.json script section dev config add option : --inline --hot

"scripts": {
  "build": "webpack",
  "dev": "webpack-dev-server --devtool eval --progress --inline --hot --colors --content-base build",
  "test": "echo \"Error: no test specified\" && exit 1"
},

In Webpack.config.js module section add :

plugins: [new webpack.HotModuleReplacementPlugin()]

相关推荐