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

feat: enable inlining RN entrypoints #872

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gorgeous-nails-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@callstack/repack": minor
---

Enable inlining entry modules by making runtime initialization from React renderers a no-op
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ export class RepackTargetPlugin implements RspackPluginInstance {
}
).apply(compiler);

// ReactNativePrivateInitializeCore.js is an unnecessary module exisiting in order to make metro happy
// it reexports InitializeCore which is included as one of the initial modules running before main entrypoint
// making this module noop makes inlining entry modules possible which might improve startup time
new compiler.webpack.NormalModuleReplacementPlugin(
/react-native.*?([/\\]+)Libraries[/\\]ReactPrivate[/\\]ReactNativePrivateInitializeCore\.js$/,
require.resolve('../../modules/EmptyModule.js')
).apply(compiler);

// ReactNativeTypes.js is flow type only module
new compiler.webpack.NormalModuleReplacementPlugin(
/react-native.*?([/\\]+)Libraries[/\\]Renderer[/\\]shims[/\\]ReactNativeTypes\.js$/,
Expand Down
Loading