Skip to content

fix: preserve polyfill module ids in production#1357

Merged
jbroma merged 3 commits intomainfrom
fix/always-assign-module-ids-to-polyfills
Mar 5, 2026
Merged

fix: preserve polyfill module ids in production#1357
jbroma merged 3 commits intomainfrom
fix/always-assign-module-ids-to-polyfills

Conversation

@jbroma
Copy link
Member

@jbroma jbroma commented Mar 5, 2026

Summary

Closes #1356

  • add runtime requirements in NativeEntryPlugin for RuntimeGlobals.moduleFactories and RuntimeGlobals.require so polyfills runtime always references module-id-addressable factories in optimized production output
  • add production-mode integration coverage for NativeEntryPlugin that runs with active optimizations (moduleIds: 'deterministic', output.iife: true)
  • add a regression test that intentionally removes runtime requirements to expose the broken startup shape where polyfill entries are inlined as __webpack_modules__[id]()
  • add a fix test that verifies __webpack_require__(id) calls emitted by the polyfills runtime module match the actual module ids of polyfill1 and polyfill2
  • refresh webpack/rspack snapshots for NativeEntryPlugin tests

Test plan

  • pnpm --filter integration-test test -- src/plugins/NativeEntryPlugin.test.ts

jbroma added 2 commits March 5, 2026 14:11
Add RuntimeGlobals.moduleFactories and RuntimeGlobals.require to native entry runtime requirements so optimized startup does not inline polyfill entries without module ids.

Add production-mode integration coverage that reproduces the broken inlined startup shape and verifies polyfills runtime __webpack_require__ ids match the actual polyfill module ids for webpack and rspack.
@vercel
Copy link

vercel bot commented Mar 5, 2026

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

Project Deployment Actions Updated (UTC)
repack-website Ready Ready Preview, Comment Mar 5, 2026 1:19pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: dcbd235

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

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

@jbroma jbroma changed the title fix(native-entry-plugin): preserve polyfill module ids in production fix: preserve polyfill module ids in production Mar 5, 2026
@jbroma jbroma merged commit 1705f2a into main Mar 5, 2026
5 checks passed
@jbroma jbroma deleted the fix/always-assign-module-ids-to-polyfills branch March 5, 2026 13:38
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.

Unhandled JS Exception: getPropertyAsObject: property 'console' is undefined, expected an Object

1 participant