Skip to content
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

Request for ESM Distribution on npm #26897

Closed
jimmywarting opened this issue Jun 4, 2023 · 2 comments
Closed

Request for ESM Distribution on npm #26897

jimmywarting opened this issue Jun 4, 2023 · 2 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@jimmywarting
Copy link

Description:
I would like to kindly request the distribution of an ECMAScript module (ESM) version of the React library on npm. Currently, React is available in UMD and CommonJS formats, but having an ESM version would greatly benefit developers who prefer or require this module format.

Benefit of ESM Distribution:

Description:
Hello, Facebook/React team! I hope you're doing well. I would like to kindly request the distribution of an ECMAScript module (ESM) version of the React library on npm. Currently, React is available in UMD and CommonJS formats, but having an ESM version would greatly benefit developers who prefer or require this module format.

Benefit of ESM Distribution:
Simpler Import Syntax: ESM provides a simpler and more streamlined import syntax, allowing developers to use the import statement directly. This can make the codebase cleaner and more readable.

Better Compatibility with Modern Tools: Many modern build tools, bundlers, and frameworks have excellent support for ESM. By distributing React as an ESM, it would align with the ecosystem and make it easier to integrate with these tools.

Future-Proofing: ESM is the standardized module format in ECMAScript, and its usage is growing rapidly. By providing an ESM version of React, you would future-proof the library and ensure it remains compatible and accessible to developers as the ecosystem evolves.

I would love it if i could do something like:

<script type="importmap">
      {
        "imports": {
          "react": "https://cdn.jsdelivr.net/npm/react/esm/react.development.js",
          "react-dom/client": "https://cdn.jsdelivr.net/npm/react-dom/esm/react-dom.development.js"
        }
      }
</script>

and then import it like noramlly:

import * as react from 'react'
import {  } from 'react-dom/client'

i tried using jsfiddle /+esm feature that you append at the end, but it seems like react-dom wants to find React on the global scope.
it seems to work okey with react but not for react-dom

I understand that distributing React as an ESM might involve some changes and considerations on your end, but I believe the benefits outweigh the effort. Many developers would greatly appreciate this addition to the React ecosystem. Thank you for your consideration!

@jimmywarting jimmywarting added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jun 4, 2023
@markerikson
Copy link
Contributor

See #11503 for the extensive and multi-year prior discussion on this topic.

@jimmywarting
Copy link
Author

closing as dupl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants