Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
add jsx-runtime and jsx-dev-runtime modules #18299
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ded98d8:
|
Details of bundled changes.Comparing: 2666642...ded98d8 react
React: size: -3.5%, gzip: -2.6% Size changes (experimental) |
Details of bundled changes.Comparing: 2666642...ded98d8 react
Size changes (stable) |
| @@ -34,6 +35,7 @@ describe('ReactElement.jsx', () => { | |||
| ReactFeatureFlags.warnAboutSpreadingKeyToJSX = true; | |||
gaearon
Mar 13, 2020
•
Member
If this test wasn't marked as "internal", it would fail on bundles as it should — because we haven't exposed these entry points on npm. To do that, check out how files in npm/ folders in different packages work. Also note "files" array in package.json of each package. (Oops, you have that part — but still need npm entry points.)
If this test wasn't marked as "internal", it would fail on bundles as it should — because we haven't exposed these entry points on npm. To do that, check out how files in npm/ folders in different packages work. Also note (Oops, you have that part — but still need "files" array in package.json of each package.npm entry points.)
|
Need to add npm entry points. |
|
You'll also need to add them to |
|
Pls rebase :-) I think this should fail now. |
88ea8d9
to
9565d1b
|
lg, pending CI, nits and a decision on UMD bundles. Note that if we merge this now, the next release will go out with these entry points. Are we ready in terms of final naming, bundles, etc? |
ef6fb14
to
a5aa16e
| @@ -29,6 +30,7 @@ describe('ReactElement.jsx', () => { | |||
| global.Symbol = undefined; | |||
|
|
|||
| React = require('react'); | |||
| jsxRuntime = require('react/jsx-runtime'); | |||
gaearon
Mar 13, 2020
Member
Super nit: JSXRuntime in tests for capitalization consistency? I don't care tho
Super nit: JSXRuntime in tests for capitalization consistency? I don't care tho
|
Okay as we figured out, we still have an issue with duplication of bundle content. What we need to do is to remove jsx from the React object completely, and to create separate entry points for both runtimes. Like src/jsx/JSXRuntime. There you can put the jsx() implementation with the minimal copy paste it needs (ReactElement) and an import of the current owner from React. Note you can’t just import it from parent folder. You need to get it from require(“react”) like all other packages do. Because otherwise we’ll get a copy of it in our bundle. Then for FB bundle if we want to keep React.jsx working for a bit you could do this in the FB index file I think. Just re export from both React and Runtime. |
| @@ -29,6 +31,9 @@ | |||
| "loose-envify": "^1.1.0", | |||
| "object-assign": "^4.1.1" | |||
| }, | |||
| "peerDependencies": { | |||
gaearon
Mar 17, 2020
Member
A package can't be its own peer. This isn't needed. If our scripts complain it's our scripts that should be fixed.
A package can't be its own peer. This isn't needed. If our scripts complain it's our scripts that should be fixed.
249203e
to
2b03ad8
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ |
gaearon
Mar 17, 2020
Member
Would be nice to have @flow on this. Not blocking though because we didn't have it before either.
Would be nice to have @flow on this. Not blocking though because we didn't have it before either.
lunaruan
Mar 17, 2020
Author
Contributor
I can do this in a separate PR after landing the Babel transform!
I can do this in a separate PR after landing the Babel transform!
|
Seems legit. Please inspect the bundles manually, especially the ones in |
|
Hi |
|
@midudev Can you clarify why you need it? |
|
Thanks for the reply. Yes, trying to get working latest babel-preset-react with
I thought it was related to this PR as installing latest |
|
Right, I just wanted to confirm why you're asking. This indeed hasn't been released in stable yet. You can install |


This PR adds the
jsx-runtimeandjsx-dev-runtimemodules for the JSX Babel Plugin. WWW still relies onjsx/jsxs/jsxDEVfrom the"react"module, so once we refactor the code to point to the runtime modules we will removejsx/jsxs/jsxDEVfrom the"react"module.