-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Code using React hooks fails if components are imported from parent directory #3769
Comments
This is symptomatic of having multiple copies of React. Based on the structure of that repo, there will be two copies of React installed, one in When imported in I suppose Parcel should de-dupe identical dependencies? But strictly according to the Hoisting/de-duping the react dependency would solve this problem (possibly a use case for yarn workspaces). |
@rtsao That makes sense. We're using yarn workspaces in our repo but had our bundler sitting above the I think I agree that this is expected behavior and I'm ok marking this as closed. Thanks for your thoughtful reply. |
#3272 🐛 bug report
This is the same issue that was reported in #2709 but OP there closed it and suggested I create a new issue. So here we are.
🎛 Configuration (.babelrc, package.json, cli command)
See repo here:
https://github.com/imjared/parcel-js-react-hooks
🤔 Expected Behavior
Components with hooks should build and run as expected.
😯 Current Behavior
React hooks fail with the following error:
🔦 Context
We're operating in a monorepo. Our "bundler" (aka Parcel) lives alongside a bunch of package directories. Each directory can contain components that we want to bundle and deploy for use on a WordPress site. Components using the older class-based syntax load as expected. Components with hooks fail.
💻 Code Sample
https://github.com/imjared/parcel-js-react-hooks
🌍 Your Environment
The text was updated successfully, but these errors were encountered: