Skip to content

module.hot.invalidate is not a function #174

@aditya81070

Description

@aditya81070

I am trying this plugin with webpack-dev-server. I followed the instructions to add this plugin to code and also checked example in webpack-dev-server in examples directory.

This is my devServer config:

    devServer: {
      host: '0.0.0.0',
      historyApiFallback: true,
      hot: true,
      clientLogLevel: 'info',
      inline: true,
      liveReload: false,
      overlay: true,
      port: 8080,
    },

I am also using following code snippet to use HMR:-

if (module.hot) {
    module.hot.accept('./app', () => {
     const App = require('./app').default
     ReactDOM.render(<App />, root);
})
}

After adding the plugin to my webpack.config.js, I changed the label text of Input component. (The input component and the component in which it is used both are functional components). I am getting following error:-

TypeError
module.hot.invalidate is not a function

Call Stack
 Object.eval
  //path of component
 eval
  //path of component
 Object..//path of component
  58.009bff0c7f3cf3782d9f.hot-update.js:6:1
 __webpack_require__
  main.js:794:31
 hotApply
  main.js:710:14
 undefined
  main.js:364:22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions