Skip to content

fix: use import default esm helper for esm path imports - #1302

Merged
jbroma merged 7 commits into
mainfrom
fix/windows-compatible-imports
Nov 3, 2025
Merged

jbroma merged 7 commits into
mainfrom
fix/windows-compatible-imports

Conversation

@jbroma

@jbroma jbroma commented Nov 3, 2025 •

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Nov 3, 2025 •

Copy link
Copy Markdown

🦋 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

vercel Bot commented Nov 3, 2025 •

Copy link
Copy Markdown

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

jbroma commented Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

@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

This branch was successfully deployed

1 active deployment
Preview — 7aefdc64 Deployed Nov 3, 2025 by vercel[bot]
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

1 participant