-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Invalid hook call in React only when using Webpack rather than the Vite bundler #19471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that for some reason, after I migrated my |
There is no problem here who is better - What's the problem? You *can't using https://nodejs.org/api/esm.html#import-specifiers
https://docs.deno.com/runtime/fundamentals/modules/
Using your library can be broken for other developers. You have |
@alexander-akait I've deleted the SO question, but here's the Reddit post detailing everything: https://www.reddit.com/r/learnjavascript/comments/1k4neum/invalid_hook_call_in_react_using_webpack/ |
I recommend do not study how |
@hydroperx Do you still have a problem with webpack? |
@alexander-akait Right now, it'd be first this "new" exports issue that you've responded to, and then this misleading React hook error as I've given full information in the above Reddit post. |
I've to give it a try to fix that exports issue, but I'd have to update my react library for that :/ |
When I said exports I refer to the |
I don't think you need to do it
It means you have two different copies of We respect the |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Bug report
What is the current behavior?
When serving my Webpack + TypeScript + React project I'm getting:
If the current behavior is a bug, please provide the steps to reproduce.
npm i && npm run dev
The error indicates that I am using React wrongly, but I confirmed I am using component top-level hooks only and the React and react-dom packages are not duplicating.
Full information here on why I'm doing it right.
@hydroperx/fluent
.My only workaround is to simply use Vite instead of Webpack.
What is the expected behavior?
Display a webpage with user interface elements such as a heading title "Metro demo", and several other components such as context menu, buttons, icons, live tiles and others, with no console or page error.
Other relevant information:
webpack version: 5.99.6
Node.js version: 22.14.0
Operating System: Windows 11
Additional tools: N/A
The text was updated successfully, but these errors were encountered: