Skip to content

Conversation

@jbroma
Copy link
Member

@jbroma jbroma commented Feb 2, 2026

Summary

  • Add polyfills as runtime modules instead of entry modules to ensure they execute before the webpack startup function
  • This means polyfills now run before Module Federation v2's embed_federation_runtime wrapper
  • Runtime modules execute during webpack runtime initialization, before __webpack_require__.x() is called

Changes

  • Move NativeEntryPlugin to its own folder
  • Add PolyfillsRuntimeModule that inlines polyfill code directly into the webpack runtime
  • Use additionalTreeRuntimeRequirements hook to add polyfills as runtime modules
  • Add comprehensive tests with MF v2 integration

Execution Order

With this change, the execution order is now:

  1. Polyfills (as runtime modules - before startup)
  2. MF v2 federation runtime (via embed_federation_runtime wrapper)
  3. InitializeCore, app entry, etc. (via prevStartup())

Related Issues

This could potentially close:

Test Plan

  • Added unit tests that verify polyfills are added as runtime modules
  • Added tests that verify execution order with MF v2
  • All existing tests pass

🤖 Generated with Claude Code

…execution order

Polyfills are now added as runtime modules instead of entry modules.
This ensures they execute before the webpack startup function, which
means they run before Module Federation v2 embed_federation_runtime
wrapper.

Runtime modules execute during webpack runtime initialization, before
__webpack_require__.x() (the startup function) is called. This guarantees
polyfills run before any MF v2 federation runtime code.

Changes:
- Move NativeEntryPlugin to its own folder
- Add PolyfillsRuntimeModule that inlines polyfill code
- Use additionalTreeRuntimeRequirements hook to add polyfills
- Add comprehensive tests with MF v2 integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repack-website Ready Ready Preview, Comment Feb 2, 2026 9:16pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

⚠️ No Changeset found

Latest commit: 0d821ee

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jbroma
Copy link
Member Author

jbroma commented Feb 2, 2026

needs more tests being added:

  1. needs tests with MFv1
  2. needs tests with older versions of MF2 (without __webpack_require__.x use)
  3. needs tests with webpack

@jbroma jbroma changed the title fix(NativeEntryPlugin): add polyfills as runtime modules for correct execution order fix: add polyfills as runtime modules for correct execution order Feb 2, 2026
@jbroma jbroma changed the title fix: add polyfills as runtime modules for correct execution order fix: add RN polyfills as runtime modules for correct execution order Feb 2, 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.

2 participants