nwb icon indicating copy to clipboard operation
nwb copied to clipboard

Can't disable hot module reloading via middleware

Open xzilja opened this issue 7 years ago • 2 comments

no matter what options I tried i.e.

app.use(require('nwb/express')(express, { reload: false, hmre: false }));

I can still see logs for HMR in browser console, trying to disable it in order to improve dev experience as it is sometimes to laggy in chrome for some reason. Is this broken or maybe docs are outdated on how to disable it in custom server.js?

xzilja avatar Jul 11 '17 11:07 xzilja

hmre is specifically for disabling use of React Transform and reload is used to configure webpack-hot-middleware's client - doing this would involve adding another option to skip using webpack-hot-middleware and its client entirely:

  • https://github.com/insin/nwb/blob/035b93d38241ee0c67bf54c18963011d9b98b513/src/expressMiddleware.js#L79-L81
  • https://github.com/insin/nwb/blob/035b93d38241ee0c67bf54c18963011d9b98b513/src/createServerWebpackConfig.js#L24-L34

The following is a bit of a mess at the moment, it was only added to allow Karma tests to disable HMR and can't be configured externally yet. I think we need a single flag to disable all this stuff:

  • https://github.com/insin/nwb/blob/035b93d38241ee0c67bf54c18963011d9b98b513/src/createWebpackConfig.js#L533
  • https://github.com/insin/nwb/blob/45529647d25e79ad5c6e02aca7eb2100b28d6693/src/createKarmaConfig.js#L204

It should also flip this to false by default:

  • https://github.com/insin/nwb/blob/f0d445e3adb71650b3728ad87e37815e094caef1/src/devServer.js#L21

insin avatar Jul 11 '17 14:07 insin

I can't believe you still don't let us disable hot reload and just watch for a change

javadbat avatar Aug 26 '18 13:08 javadbat