react icon indicating copy to clipboard operation
react copied to clipboard

Bug: Support ESM for the use-sync-external-store shim

Open s-cork opened this issue 3 years ago • 4 comments

React version: use-sync-external-store 1.0.0, 1.1.0

Steps To Reproduce

  1. 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.

s-cork avatar May 20 '22 23:05 s-cork

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.

brophdawg11 avatar Jun 06 '22 15:06 brophdawg11

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!

github-actions[bot] avatar Apr 10 '24 06:04 github-actions[bot]

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

HansBrende avatar Apr 19 '24 03:04 HansBrende

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!

github-actions[bot] avatar Jul 18 '24 04:07 github-actions[bot]

Please stop closing issues with no real resolution.

igorkamyshev avatar Jul 18 '24 06:07 igorkamyshev