-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
From Collection.mjs : use-sync-external-store/shim/index.js doesn't provide an export named: 'useSyncExternalStore' #6694
Comments
Where did you read this? I'm not sure what we'd be relying on that would be different between the two, but I might be forgetting something, this was added a while ago. |
Here in the code : // React 16 and 17 don't support useSyncExternalStore natively, and the shim provided by React does not support getServerSnapshot.
// This wrapper uses the shim, but additionally calls getServerSnapshot during SSR (according to SSRProvider).
function $7135fc7d473fd974$var$useSyncExternalStoreFallback(subscribe, getSnapshot, getServerSnapshot) { |
It shouldn't be an issue for you. You don't get to that code unless you're using a version of React which doesn't have
So you shouldn't get to that code and it's fine to just replace it.
You might have something with the cjs/mjs observation. They should be fine to use together, your bundler should be able to interop them. However, you might look to see if Vite has any issues with that. For example, you'll notice we have mjs/module.js/main.js, the cjs one just isn't called cjs because webpack 4 had issues with that. I think it'd be best to create a minimal reproduction so we can see what's going on. |
@ppoulard My app started having this same issue today. Did you ever find a resolution? I'm on react 18. I wonder if this react issue is related? |
@stdavis Hi, the only workaround I found is the one mentioned at the start of this thread. |
Provide a general summary of the issue here
I wrote my first components almost like the ones supplied in react-aria (with vanilla css), and they worked in Storybook
But when imported in my big app made with vite (just starting with a little Tooltip) it just crashes
🤔 Expected Behavior?
It should not crash
😯 Current Behavior
Fatal error in the console, due to
react-aria-components/dist/Collection.mjs
:💁 Possible Solution
Temporarily, I used the following config in vite :
but I'm not sure whether it is reliable because I read somewhere in the docs that there was some specific stuff in the shim that are expected by react-aria
However, I don't intend to use react < 18
Thanks for your help
🔦 Context
No response
🖥️ Steps to Reproduce
It's a rather big app, so I have not a minimal test case, but it sounds like a typescript import incompability cjs from mjs due to
use-sync-external-store/shim
Version
"react-aria-components": "1.2.1"
What browsers are you seeing the problem on?
Firefox
If other, please specify.
No response
What operating system are you using?
Mac OS 14.4.1 (23E224)
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: