facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
228.87k stars 46.83k forks source link

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

Open s-cork opened 2 years ago

s-cork commented 2 years ago

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/valtio@1.6.0";

or in the console

>>> var v = await import("https://cdn.skypack.dev/valtio@1.6.0")
Uncaught SyntaxError: The requested module '/-/use-sync-external-store@v1.0.0-ZzO0qn27iKOvDc2m57IV/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/valtio@1.6.1") Still fails on the use-sync-external-store shim.

brophdawg11 commented 2 years ago

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.

github-actions[bot] commented 6 months ago

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!

1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP commented 6 months ago

It has a PR, please merge

HansBrende commented 6 months ago

It has in fact TWO PRs: https://github.com/facebook/react/pull/26230 and https://github.com/facebook/react/pull/25231

github-actions[bot] commented 3 months ago

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!

igorkamyshev commented 3 months ago

Please stop closing issues with no real resolution.

github-actions[bot] commented 2 weeks ago

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!

igorkamyshev commented 2 weeks ago

Bump