Search code examples
reactjswebpackreact-hot-loader

React-hot-loader: fatal error caused by XXX - no instrumentation found


I'm trying to configure react-hot-loader 4.0.0 with React 16.2 and Webpack 2.6.1.

It works for some changes, but for others I get the following error:
React-hot-loader: fatal error caused by ƒ Connect(props, context) and
no instrumentation found. Please require react-hot-loader before React. More in troubleshooting

I did indeed see the troubleshooting and it says I need to import react-hot-loader before I import React.

Thing is, i'm not importing React. I'm using it globally using webpack expose-loader.

I didn't really understand from the docs if I need to add this import to each component...

Any help would be greatly appreciated. Thanks,
Uri


Solution

  • Trying to resolve this issue I changed my React import so that instead of exposing it globally using the expose-loader, I import it in every file. Then, I tried importing RHL after React (as stated in their troubleshooting page), but that didn't help either.

    So, I can't pin point the exact reason for the error, but looking around RHL v4 issues I saw it does not support React Router v3. Upgrading to React Router v4 solved the issue for me.