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

Always exempt Babel runtime helpers from inline (lazy) requires #1127

Closed
wants to merge 1 commit into from

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Oct 31, 2023

Summary

There is no benefit to treating Babel helpers with lazy requires. They are always going to be needed, and their initialization is extremely cheap, so it just bloats up the code and adds extra runtime indirection on every access to them.

I considered a few alternatives:

I'm not particularly enthusiastic about doing the bigger changes myself. I think hardcoding it here is fine because there's basically no legit reason for wanting these to be lazy. In fact they might even not be lazy anyway depending on where in your compilation pipeline the runtime plugin is injected. But this is nice because it fixes it for all RN users with inline requires.

Test plan

Ran my app with the change. The app works. The diff looks like I'd expect, for example:

Screenshot 2023-10-31 at 00 40 00

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 31, 2023
@facebook-github-bot
Copy link
Contributor

@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@robhogan merged this pull request in fcd8867.

@gaearon gaearon deleted the patch-2 branch November 3, 2023 23:59
@zhusjfaker
Copy link

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants