-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
Provide new jsx transform target for reactjs/rfcs#107 #15141
Conversation
React: size: 0.0%, gzip: -0.0% Details of bundled changes.Comparing: 43b1f74...5153dc5 react
Generated by 🚫 dangerJS |
I suspect that tests are failing because CI tests against the bundles and uses |
You can add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Sizebot is reporting that file size went up in the Node bundle. UMD is fine (or maybe already broken). Some compilation artifact seems to not work correctly to DCE these.
There were a couple new feature flag forks added for the new scheduler - I thought maybe missing those had caused this issue, but after adding them it seems that sizebot is still reporting an increase (although only on NODE_PROD - does the absence of a row here mean there's no increase?). Looking at |
Hm. I can't repro locally neither. |
packages/react/src/ReactElement.js
Outdated
* @internal | ||
*/ | ||
const ReactElement = function(type, key, ref, self, source, owner, props) { | ||
const ReactElement = function(type, props, key, ref, owner, self, source) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so I downloaded the artifacts. Somehow, this is not getting inlined anymore. That's why the file increases.
I'm not sure if it's called in more places and maybe it stops trying to inline it before it's able DCE the other paths.
It could also be the argument order. You could try restoring the argument order. It might have an effect on the compiler since the property reads of mutable values are not pure operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey looks like reordering fixes it! Wild. Now there is only a size regression on WWW prod which is to be expected since the feature is turned on there.
Neat! Feel free to "Squash and merge". |
This exposes two new top-level functions on
React
-jsx
, andjsxs
. These are targets for JSX transformers which open up many simplifications to element creation described in reactjs/rfcs#107.The intent is to be backwards-compatible with the existing
createElement
call and to migrate transformers over so that most people are using this new transform. Once there are actual transforms written against this api, the more substantive changes can be tested.