webpack提示 [HMR] Hot Module Replacement is disabled

才webpack开发前端,刷新页面提示:Uncaught Error: [HMR] Hot Module Replacement is disabled,页面中的内容没有渲染出来,哪位高手看看?server.js脚本如下:

var webpack = require("webpack")
var webpackDevServer=require("webpack-dev-server")
var config = require("./webpack.config.js");

config.entry.unshift("webpack-dev-server/client?http://localhost:8080", "webpack/hot/dev-server","./src/main.js");

var compiler = webpack(config);
var server = new webpackDevServer(compiler, {
  publicPath: "http://localhost:8080/dist/",
  hot: true,
  quiet: true,
  noInfo: false,
  filename: "build.js",
  historyApiFallback: false,
  stats: { colors: true },
  proxy: {
    "/test/*": {
      target:"http://localhost:8088",
      secure: false,
    }
  },
  watchOptions: {
    aggregateTimeout: 300,
    poll: true
  }
});
server.listen(8080);
阅读 24.8k
2 个回答

webpack的配置里面加这个了吗?

  plugins: [
    new webpack.HotModuleReplacementPlugin()
  ],

webpack-dev-server --hot --inline

推荐问题
宣传栏