-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
export "useId" was not found in "react" #82
Comments
Just a warning? Should be safe to ignore. It's coming from react-resizable-panels/packages/react-resizable-panels/src/hooks/useUniqueId.ts Lines 1 to 16 in 4151a63
|
Damn, thank you for the fast response! |
No prob! Sorry for the confusion. |
I can confirm it raises an error on React v17. As it is trying to import useId and it does not exists. ERROR in ./node_modules/react-resizable-panels/dist/react-resizable-panels.module.js 8:68-80 |
Can you share a repro for this? Same as I asked for with #104. |
Here is a repro using CRA and React v17, and a possible work-around for webpack. Thanks! |
@brightloudnoise Thanks for the work around pointer. - const useReactId = (React as any).useId as () => string;
+ // `toString()` prevents bundlers from trying to `import { useId } from 'react'`
+ const useReactId = (React as any)['useId'.toString()] as () => string; That's some funky syntax! I'm not opposed to adding it here, provided it doesn't break anything though. |
Thinking about this a little more and I worry this might cause tree shaking issues. Admittedly the Ideally though, this would be something that Webpack supports: (webpack/webpack#14814) Maybe it's okay to make this change on our side in the meanwhile. |
Closed via ed96947 |
Fixed in 0.0.38 |
Should be fixed in 0.0.39 |
Thanks for the fixes, and sorry the workaround caused other headaches. |
No worries 😄 |
Please note: This is related to Webpack issue: webpack/webpack#14814
Some bundles (Webpack) may throw an error during compilation if code references a named import that a module does not export– even if the import is only used conditionally.
The error thrown by Webpack will look like:
To work around this, the following change was made in 0.0.38:
Unfortunately it caused a regression and was reverted in 0.0.39. (Seemingly the new syntax confused Parcel.)
(Description modified by @bvaughn)
The text was updated successfully, but these errors were encountered: