Bug: Support ESM for the use-sync-external-store shim
React version: use-sync-external-store 1.0.0, 1.1.0
Steps To Reproduce
- open up chrome dev tools
>>> var x = await import("https://cdn.skypack.dev/use-sync-external-store")
>>> x.useSyncExternalStore
undefined
Link to code example: See above code snippet I was trying to hack around with valtio and if I do
import valtio from "https://cdn.skypack.dev/[email protected]";
or in the console
>>> var v = await import("https://cdn.skypack.dev/[email protected]")
Uncaught SyntaxError: The requested module '/-/[email protected]/dist=es2019,mode=imports/unoptimized/shim/index.js' does not provide an export named 'useSyncExternalStore'
The current behavior
the use-sync-external-store shim does not support esm
The expected behavior
please support esm
additional context
the bug was reported at valtio
https://github.com/pmndrs/valtio/issues/452
An attempt was made to workaround the issue at their end
But the import
>>> var v = await import("https://cdn.skypack.dev/[email protected]")
Still fails on the use-sync-external-store shim.
Related - would it also be possible to provide a UMD build as well? We're looking to use this in the new version of react-router but having some trouble bundling our own UMD module without ESM or UMD support.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
It has a PR, please merge
It has in fact TWO PRs: https://github.com/facebook/react/pull/26230 and https://github.com/facebook/react/pull/25231
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Please stop closing issues with no real resolution.