-
Notifications
You must be signed in to change notification settings - Fork 47k
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
umd distribution for jsx-runtime #20923
Comments
Talking about WordPress development, WordPress/Gutenberg also includes We can stick to use the |
Some update about it? |
Any news on this? It would be interesting to have it. |
I just looked at the minified production source for React 17.0.2 and realized this is quite easy to do yourself. Tough the JSX runtime does depend on
I stripped the Minified production runtime exposed as |
My current understanding is we're planning to eventually deprecate/remove UMD builds altogether in favor of ESM builds. I'm guessing this would mean you could set up an import map, and have it point inside the npm package? |
How would an ESM build expose react if I was to load it from a CDN? Will I still be able to access react from the global environment? |
You'd use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules |
Okay so this
becomes
but that won't work with subresource integrity which I find important when pulling scripts from CDN. |
look it |
@idler8 If your project is using Typescript and until the ESM builds are available, I suggest you to use the following TS config:
With Downside: like @leidegre explain it in the comment below, you will lose |
You understand that this forgoes all benefits of the work done to improve React performance via the JSX runtime? Why would you just "turn it off"? |
Hey, I'm facing an issue in my monorepo project, where I have shared React components among different libraries within the workspace. These components are integrated into a legacy application through web components. To maintain consistency in React versions in the browser, React and React DOM are excluded from the final build and are treated as external dependencies, using The problem I'm encountering is when I use a component from library A with a component from library B, such as My current workaround involves manually adding a I'm wondering if there have been any developments on this issue, and if anyone has a better solution for a monorepo that ensures a single JSX runtime. Thanks! Edit on 2023-11-15 // vite.config.ts
const config = mergeConfig(defaultConfig, {
build: {
lib: {
entry: path.resolve(__dirname, 'src/lib/index.ts'),
name: 'XLib',
},
rollupOptions: {
external: ['react/jsx-runtime'],
},
},
}); |
A year has passed since Dan mentioned that you are working on ESM. Is there a thread or anything where we can track the progress? Not relying on legacy tooling and formats would be a pretty huge step in the right direction IMO. |
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! |
We still really need this feature, otherwise, as component library developers, we would have to import React in each file, which is really painful. |
We're removing all UMD builds, in favor of esm.sh for the demo use case, so I think it's safe to say we won't do this. |
Our module infrastructure relies on 3rd party dependencies to be available as global variables which we internally map in our module system. We are currently looking into updating to 17.x and utlize the new JSX Transform, however we noticed that there is no umd distribution for the jsx-runtime resulting in that we are not able to map this new dependency into our module system.
The reason why we have not switched over to a modern module/build system is that we are still in the progress of migrating (over time) our stack to be on top of react and in the current version (16.x) using the "old" JSX Transform we are able to achieve this through the provided umd distribution.
We could of course stick to 16.x or 17.x with the "old" JSX Transform, however with the rebase to react we kind of want to be future proof at the same time, so being on the new Transform would be preferred imo.
I do understand this might be a bit of a far reach due to the proprietary module infrastructure, but I think more people could benefit from having the jsx-runtime at hand as umd distribution.
The text was updated successfully, but these errors were encountered: