Skip to content

Add enableBabelRuntime option to reduce a bundle size - #228

Closed
retyui wants to merge 1 commit into
react-native-community:mainfrom
retyui:metro-babel-runtime-version
Closed

Add enableBabelRuntime option to reduce a bundle size#228
retyui wants to merge 1 commit into
react-native-community:mainfrom
retyui:metro-babel-runtime-version

Conversation

@retyui

@retyui retyui commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary:

I described the issue here: https://x.com/tell_me_mur/status/2064328541861183526?s=20

shorty without babel runtime version specified, babel helpers will be inlined multiple times across different files instead on imported once

Changelog:

[GENERAL] [ADDED] - Add enableBabelRuntime option to reduce a bundle size

Test Plan:

...

@cortinico
cortinico requested a review from robhogan June 12, 2026 09:59
@cortinico

Copy link
Copy Markdown
Member

cc @robhogan

@retyui
retyui force-pushed the metro-babel-runtime-version branch from 3cba525 to 27812f3 Compare August 31, 2026 14:15
@retyui

retyui commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@robhogan Do you think we can merge this change to the template ?

@robhogan

Copy link
Copy Markdown
Collaborator

I appreciate the direction here but I don’t want to be adding more to the template that doubles down on the assumption that source files have a known local version of @babel/runtime - that breaks down as soon as you put the template in a workspace and try to depend on code outside.

The way I’m looking to do this is to bypass hierarchical lookup for @babel/runtime by having plugin-transform-runtime instead inject metro:babel-runtime references, and then we can control where that resolves to - a dependency of the build toolchain rather than of the app. Runtime and version can be passed through the template in that case.

The wiring (scheme resolvers, moduleName via caller) is mostly shipped now and I’m aiming to get that into the next RN cut. The end result will be no template dependency on @babel/runtime at all, so less boilerplate for users to manage.

@retyui retyui closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants