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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏