Skip to content

fix(metro-core): normalize Windows path handling in Metro federation#4453

Merged
ScriptedAlchemy merged 33 commits intomainfrom
cursor/module-federation-windows-runtime-606f
Mar 3, 2026
Merged

fix(metro-core): normalize Windows path handling in Metro federation#4453
ScriptedAlchemy merged 33 commits intomainfrom
cursor/module-federation-windows-runtime-606f

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

@ScriptedAlchemy ScriptedAlchemy commented Feb 16, 2026

Summary

This PR now only contains metro-core fixes for Windows path handling in Metro Module Federation runtime/bundling.

All previously added CI workflow and apps/metro-example-* Jest config changes were reverted and are no longer part of this PR.

What Changed

  • Normalize path separators to POSIX form when generating host/remote virtual module imports and runtime plugin imports.
  • Normalize entry path handling for resolver entry regexes and manifest rewrite targets.
  • Fix generated Babel transformer injection by stringifying transformer path so Windows paths are valid in require(...).
  • Add command path utilities for:
    • normalized relative output paths
    • file:// source URL generation for split bundles
  • Update remote bundle path mapping to use normalized relative paths.
  • Harden serializer expose resolution by:
    • normalizing compared entry paths
    • preferring exact expose matches before extensionless fallback
  • Expand shared option validation to reject Windows-style relative/absolute/UNC paths.
  • Update packages/metro-core/tsconfig.json includes for explicit TS source globs.
  • Add/adjust unit tests covering these Windows path and serializer behaviors.
  • Add changeset for @module-federation/metro patch release.

Effective Diff Scope vs main

  • .changeset/fair-eels-grab.md
  • packages/metro-core/src/**
  • packages/metro-core/__tests__/**
  • packages/metro-core/tsconfig.json

No .github/workflows/** or apps/metro-example-*/jest.config.js changes remain.

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

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
Copy Markdown

changeset-bot bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: d8e354f

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
Copy Markdown

netlify bot commented Feb 16, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit d8e354f
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69a61d6997c9e70008929cdd
😎 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
Copy Markdown

pkg-pr-new bot commented Feb 17, 2026

Open in StackBlitz

@module-federation/devtools

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

@module-federation/cli

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

create-module-federation

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

@module-federation/data-prefetch

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

@module-federation/dts-plugin

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

@module-federation/enhanced

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

@module-federation/error-codes

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

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@f6421df

@module-federation/managers

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

@module-federation/manifest

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

@module-federation/metro

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

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

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

@module-federation/metro-plugin-rnef

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

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@f6421df

@module-federation/modern-js-v3

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

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@f6421df

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@f6421df

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@f6421df

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@f6421df

@module-federation/retry-plugin

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

@module-federation/rsbuild-plugin

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

@module-federation/rspack

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

@module-federation/rspress-plugin

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

@module-federation/runtime

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

@module-federation/runtime-core

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

@module-federation/runtime-tools

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

@module-federation/sdk

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

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@f6421df

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

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

@module-federation/treeshake-frontend

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

@module-federation/treeshake-server

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

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@f6421df

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@f6421df

@module-federation/webpack-bundler-runtime

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

@module-federation/bridge-react

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

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

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

@module-federation/bridge-shared

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

@module-federation/bridge-vue3

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

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

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

commit: f6421df

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 17, 2026

Bundle Size Report

4 package(s) changed, 37 unchanged.

Package Total dist Delta ESM gzip Delta
metro-core 243.9 kB +6.6 kB (+2.8%) 147 B no change
runtime-core 245.1 kB +288 B (+0.1%) 474 B no change
webpack-bundler-runtime 89.5 kB +213 B (+0.2%) 405 B no change
runtime-tools 4.9 kB +39 B (+0.8%) 95 B no change

Total dist: 6.70 MB (+7.1 kB (+0.1%))
Total ESM gzip: 79.0 kB (no change)

@ScriptedAlchemy
Copy link
Copy Markdown
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
Copy Markdown
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

ScriptedAlchemy and others added 3 commits February 24, 2026 11:16
Drop duplicate metro package build/test steps from e2e-metro-windows.
Prepare iOS and Android remotes through host e2e prepare scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ScriptedAlchemy ScriptedAlchemy changed the title fix(metro-core): improve Windows metro runtime compatibility fix(metro-core): normalize Windows path handling in Metro federation Feb 26, 2026
@ScriptedAlchemy ScriptedAlchemy merged commit 5eef805 into main Mar 3, 2026
24 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the cursor/module-federation-windows-runtime-606f branch March 3, 2026 00:05
@2heal1 2heal1 mentioned this pull request Mar 5, 2026
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