react-hot-loader: `hot` could not find the `id` property in the `module` you have provided
Uncaught Error: React-hot-loader: hot could not find the id property in the module you have provided
Expected behavior
The getting started guide works as expected
Actual behavior
What actually happens: above mentioned error is thrown
Environment
React Hot Loader version: 4.8.2
Run these commands in the project folder and fill in their results:
node -v: v8.9.4npm -v: 5.6.0
Then, specify:
- Operating system: MacOS Mojave
- Browser and version: Chrome Version 73.0.3683.103 (Official Build) (64-bit)
Error is thrown from:
import React from 'react';
import { hot } from 'react-hot-loader';
const App = () => <div>Hello world!</div>;
export default hot(App);
which is taken from Getting started guide
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 18
Commits related to this issue
- fix: make API more error prone, fixes #1228 — committed to gaearon/react-hot-loader by theKashey 5 years ago
^ that
Try
import { hot } from 'react-hot-loader/root';.Update I was able to get it working thanks to this thread https://github.com/gaearon/react-hot-loader/issues/911
This is just a “too many cooks in the kitchen” problem. My problem was I was enabled HotModuleReplacementPlugin() based on one doc AND
hot: truefor dev server. When you do this with the directions listed onreact-hot-loaderdoc you get the error about how your system is not compatible withreact-hot-loader/rootwhich is a false positive, i believe. The maximum call size you might be seeing is because (I imagine) webpack is injecting hot reloading twice, causing infinite recursion.You are doing your best to keep
your systemsecret.react-hot-loader/rootis 10 lines long, try to understand why it throws an error.Because nobody provided any example to reproduce. Every time (like here - #1240) I am asking for it, but nobody ever provided it or tried to spend their time to debug the issue.
What you shall understand - there is a standard module API. It says
modulevariable. A global local for each module..id,.filenameor.ifields. That’s more bound to the actual system..parents(webpack) or.parent(nodejs).require.cacheshall contain a Map to these modules.If
there is no.idin themoduleyou provided- than you provided a wrongmodule, orHotModuleReplacementPluginwhich injects some portions of that “module system” is not installed. Or something else, like twoHotModuleReplacementPlugininstalled.In any case - the problem is with your code, and there is nothing I could fix from side of mine one. I am happy to help, once you provide example to play with. Without any example - please excuse my low telepathy skills - they are not working via network, yet.
If something is wrong with
modulevariable, which is injected via webpack - feel free to open issue for webpack, but they would not say “thank you”. What about providing some information here - just list the content of it, and then we might try to understand where the.idwent.And yet again - “you” are the only one who have the issue and able to debug and mitigate it.
Real nice.
I’m caught in the same conundrum here. Using ‘react-hot-loader/root’ gives me an error telling me to stop using that import path. Using the other import path gives me the same exception as OP.
Why is this closed? I don’t see any resolution in the issue.
I am getting the same error. However, when I try the solution proposed above I get:
Uncaught Error: React-Hot-Loader:react-hot-loader/rootis not supported on your system. Please useimport {hot} from “react-hot-loader”insteadThanks @framerate. I had the same issue. ie. used
webpack-dev-server --hotplus load theHotModuleReplacementPluginwebpack plugin inside my webpack config.@bugs181 - I really need some help here. There is a parcel example here, and it just works. How it works - so - this is how it works…
From this image it’s clearly visible why
react-hot-loader/rootwould not work - there is noparentsfield present, but I do have themodule.id, and I have no idea why it could be not present. There is nothing special about my example, and nothing about React-Hot-Loader -modulevariable is provided bywebpack,nodeorparcel. And if you don’t have it, or it’s has a different shape - try to understand WHY and share the results.Trying to be as polite as possible, but I’ve invested some time trying to solve this issue and only asking you to do the same.