jlongster / monkey-hot-loader

A webpack loader to hot reload JavaScript modules
171 stars 11 forks source link

How to resolve - Error: [HMR] Hot Module Replacement is disabled #7

Closed iroy2000 closed 7 years ago

iroy2000 commented 7 years ago

I'm trying to follow the instruction here

webpack.config.server.dev.babel.js ''' entry: [ 'webpack/hot/signal.js', SERVER_ENTRY_POINT ],

// ...

plugins: [ new webpack.HotModuleReplacementPlugin() ] '''

And I run this command

webpack --config webpack.config.server.dev.babel.js --watch

And seems like it is working


However, when I run this command

nodemon my-build/index.js -- watch

I got the following error ...

/node_modules/webpack/hot/signal.js:64
        throw new Error("[HMR] Hot Module Replacement is disabled.");
        ^
Error: [HMR] Hot Module Replacement is disabled.

Error: [HMR] Hot Module Replacement is disabled.
    at Object.<anonymous> (/Users/iroy2000/development/test/node_modules/webpack/hot/signal.js:64:8)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)

How can I resolve that issue? Thanks for any help.

johnmurphy01 commented 6 years ago

How was this resolved? I'm having the same problem

cha0s commented 5 years ago

Hey, wanted to note for anyone else stumbling across this due to a search, the reason it wasn't working for me is because on the server I had node_modules marked as externals, e.g:

  nodeExternals({
    whitelist: /(?:@mylib)/,
  }),

but what I needed to do was also whitelist the HMR entrypoint:

  nodeExternals({
    whitelist: /(?:@mylib|webpack\/hot\/signal)/,
  }),

Hope that helps the next poor soul! :heart: