Uncaught TypeError: Cannot read property ‘hot’ of undefined

I have hot loading setup and partially working with React Hot Loader 3.

Reloading components works fine. However, whenever I reload a Redux reducer or action I am receiving the following error:

Uncaught TypeError: Cannot read property 'hot' of undefined

  getAffectedStuff @ client.js:351
  hotApply @ client.js:386
  (anonymous function) @ only-dev-server.js:32
  hotUpdateDownloaded @ client.js:312
  hotAddUpdateChunk @ client.js:284
  webpackHotUpdateCallback @ client.js:5
  (anonymous function) @ 0.4221176….hot-update.js:1

Relevant parts of code here:

configureStore({ url }).then( store => {
    <AppContainer component={ Root } props={{ store }} />,
    document.querySelector( '.app' )

  if ( __DEVELOPMENT__ && module.hot ) {
    module.hot.accept([ './common/components/Root', './common/store/configureStore' ], () => {
          component={ require( './common/components/Root' ).default }
          props={{ store }}
        document.querySelector( '.app' )
}).catch( console.error.bind( console ));

And here:

if ( __DEVELOPMENT__ && module.hot ) {
  module.hot.accept( '../reducers', () => {
    store.replaceReducer( require( '../reducers' ).default );

Author: Fantashit

4 thoughts on “Uncaught TypeError: Cannot read property ‘hot’ of undefined

  1. I am encountering the same sporadically when hot reloading my server.

    I think this may be the culprit:

    module = installedModules[moduleId];

    in all the other places module is guarded against being undefined but here apparently not?

    error is:

    [HMR] Update failed: TypeError: Cannot read property 'hot' of undefined
        at hotApply (/.../build/server/webpack:/webpack/bootstrap 7bade06584d268e6755d:520:1)
        at hotUpdateDownloaded (/.../build/server/webpack:/webpack/bootstrap 7bade06584d268e6755d:245:1)
        at hotAddUpdateChunk (/.../build/server/webpack:/webpack/bootstrap 7bade06584d268e6755d:225:1)
        at hotDownloadUpdateChunk (/.../build/server/webpack:/webpack/bootstrap 7bade06584d268e6755d:3:1)
        at hotEnsureUpdateChunk (/.../build/server/webpack:/webpack/bootstrap 7bade06584d268e6755d:235:1)
        at /.../build/server/webpack:/webpack/bootstrap 7bade06584d268e6755d:206:1

    (…/build/server is the outputDir)

Comments are closed.