Skip to content

Comments

fix(metro-core): improve Windows metro runtime compatibility#4453

Open
ScriptedAlchemy wants to merge 15 commits intomainfrom
cursor/module-federation-windows-runtime-606f
Open

fix(metro-core): improve Windows metro runtime compatibility#4453
ScriptedAlchemy wants to merge 15 commits intomainfrom
cursor/module-federation-windows-runtime-606f

Conversation

@ScriptedAlchemy
Copy link
Member

Description

fix(metro-core): Normalize Windows module paths for module federation

This PR addresses issues with Metro's module federation on Windows environments where native path separators (\) cause incorrect module resolution and generation. The changes ensure that generated module specifiers and internal paths are consistently normalized to POSIX-style separators (/) to prevent build failures and ensure correct module loading.

Specifically, this includes:

  • Escaping the injected Babel transformer path for Windows compatibility.
  • Normalizing module specifiers for runtime plugin imports, host entry imports, expose import paths, and entry regex matching in the resolver.
  • Introducing a toPosixPath helper function with dedicated unit tests.

Related Issue

This PR addresses the broader problem of Windows path resolution in Metro, similar to the scope of #4442.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Open in Cursor Open in Web

cursoragent and others added 2 commits February 16, 2026 23:51
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Feb 16, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: cb3464c

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

This PR includes changesets to release 43 packages
Name Type
@module-federation/metro Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/modern-js-v3 Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/rsbuild-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/rspress-plugin Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch
remote5 Patch
remote6 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
website-new 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

@cursor cursor bot mentioned this pull request Feb 16, 2026
5 tasks
@netlify
Copy link

netlify bot commented Feb 16, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit cb3464c
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6997db71c81240000811e25c
😎 Deploy Preview https://deploy-preview-4453--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 17, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/devtools@cb3464c

@module-federation/cli

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/cli@cb3464c

create-module-federation

pnpm add https://pkg.pr.new/module-federation/core/create-module-federation@cb3464c

@module-federation/data-prefetch

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/data-prefetch@cb3464c

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/dts-plugin@cb3464c

@module-federation/enhanced

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/enhanced@cb3464c

@module-federation/error-codes

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/error-codes@cb3464c

@module-federation/managers

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/managers@cb3464c

@module-federation/manifest

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/manifest@cb3464c

@module-federation/metro

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro@cb3464c

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro-plugin-rnc-cli@cb3464c

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/metro-plugin-rnef@cb3464c

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/modern-js-v3@cb3464c

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/retry-plugin@cb3464c

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rsbuild-plugin@cb3464c

@module-federation/rspack

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rspack@cb3464c

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/rspress-plugin@cb3464c

@module-federation/runtime

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime@cb3464c

@module-federation/runtime-core

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime-core@cb3464c

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/runtime-tools@cb3464c

@module-federation/sdk

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/sdk@cb3464c

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/third-party-dts-extractor@cb3464c

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/treeshake-frontend@cb3464c

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/treeshake-server@cb3464c

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/webpack-bundler-runtime@cb3464c

@module-federation/bridge-react

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-react@cb3464c

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-react-webpack-plugin@cb3464c

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-shared@cb3464c

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/bridge-vue3@cb3464c

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/module-federation/core/@module-federation/inject-external-runtime-core-plugin@cb3464c

commit: cb3464c

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Bundle Size Report

1 package(s) changed, 40 unchanged.

Package Total dist Delta ESM gzip Delta
metro-core 225.3 kB +6.7 kB (+3.1%) 147 B no change

Total dist: 6.89 MB (+6.7 kB (+0.1%))
Total ESM gzip: 138.6 kB (no change)

@ScriptedAlchemy
Copy link
Member Author

@jbroma hows this?

@ScriptedAlchemy ScriptedAlchemy changed the title Module federation Windows runtime fix(metro-core): improve Windows metro runtime compatibility Feb 20, 2026
@ScriptedAlchemy ScriptedAlchemy marked this pull request as ready for review February 20, 2026 01:25
Copy link
Member

@jbroma jbroma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, I would still reconsider this: #4453 (comment)

In current shape, the e2e-metro-windows is not an e2e test and the tests & builds run already as part of the main workflow for whole repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants