Skip to content

Conversation

@jbroma
Copy link
Member

@jbroma jbroma commented Nov 3, 2025

Summary

Closes #1290

This PR introduces importDefaultESM helper for dynamic imports of modules that works across both MacOS and Windows

Test plan

  • - tests pass on Windows & MacOS
  • - newly created app builds on Windows & MacOS

Note

Normalize dynamic ESM imports (via new helper and fileURL) to fix Windows ERR_UNSUPPORTED_ESM_URL_SCHEME and update call sites accordingly.

  • Fix Windows ESM imports:
    • Helper: Add importDefaultESM in packages/repack/src/helpers/helpers.ts to normalize dynamic ESM imports via file URLs and return default when present.
    • Adoptions:
      • getMinimizerConfig.ts: Load terser-webpack-plugin via importDefaultESM.
      • getDevMiddleware.ts: Import @react-native/dev-middleware using url.pathToFileURL(...).
      • babelLoader/utils.ts: Load hermes-parser via importDefaultESM.
      • babelSwcLoader/utils.ts: Load @rspack/core and @swc/core via importDefaultESM; add Rspack type and simplify SWC resolution logic.
  • Release: Add changeset (patch) noting fix for ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows.

Written by Cursor Bugbot for commit 7aefdc6. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2025

🦋 Changeset detected

Latest commit: 7aefdc6

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

@vercel
Copy link

vercel bot commented Nov 3, 2025

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

Project Deployment Preview Comments Updated (UTC)
repack-website Ready Ready Preview Comment Nov 3, 2025 0:03am

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@jbroma
Copy link
Member Author

jbroma commented Nov 3, 2025

@jbroma jbroma merged commit bc3ac46 into main Nov 3, 2025
7 checks passed
@jbroma jbroma deleted the fix/windows-compatible-imports branch November 3, 2025 21:12
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.

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME] on Windows

2 participants