webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

the reload page and the reload hmr all doesn't work

Open wuliqiangqiang opened this issue 7 years ago • 2 comments

  • Operating System:
  • Node Version:9.3.0
  • NPM Version:5.5.1
  • webpack Version:4.16.5
  • webpack-dev-server Version:3.1.5
  • [x ] This is a bug
  • [ ] This is a modification request

Code

  // webpack.config.js
devServer:{ noInfo: true,
  https: false,
  disableHostCheck: true,
  inline: true,
  historyApiFallback: true,
  contentBase: '/Users/ryan/hotel/src',
  watchContentBase: true,
  watchOptions: { ignored: /node_modules/, poll: true },
  publicPath: '/',
  stats: { colors: true },
  before: [Function: before] }
}

//webpack entry is multiple entry like
{
 a:'a.js',
 b:'b.js'
}
  // additional code, remove if not needed.
//use  nodejs boot webpack
const WebpackDevServer = require("webpack-dev-server");
const devServerOptions = Object.assign(
  {},
  webpack_config.devServer,
  {
    stats: {
      colors: true
    }
  },
  {
    before(app) {
      app.use("/", router);
      app.use("/api", proxy({
        target: 'https://www.easyrentcars.com',
        changeOrigin: true
      }));

      app.use(async (err, req, res, next) => {
        if (res.headersSent) {
          return next(err);
        }
        return res.send(err);
      });

    }
  }
);
const server = new WebpackDevServer(compiler, devServerOptions);
server.listen(env_port);

Expected Behavior

the page can auto reload when editor the contentBase path file

Actual Behavior

no auto reload the page

For Bugs; How can we reproduce the behavior?

see my webpack and nodejs config

others about hmr

the hmr function also doesn't work add the

WebpackDevServer.addDevServerEntrypoints(webpack_config, {
  hot: true,
  inline:true
});

open the devServer.hot = true.

and push the plugins in the webpack plugin

// new webpack.HotModuleReplacementPlugin(),
  // new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.

when i use nodejs boot webpack its all doesn't work

wuliqiangqiang avatar Dec 28 '18 09:12 wuliqiangqiang

It looks like you just deleted our lovely crafted issue template. It was there for good reasons. Please help us solving your issue by answering the questions asked in this template. I'm closing this. Please either update the issue with the template and reopen, or open a new issue.

alexander-akait avatar Dec 28 '18 10:12 alexander-akait

@evilebottnawi update it.

wuliqiangqiang avatar Dec 28 '18 10:12 wuliqiangqiang