Skip to content

fix(module-federation): tuple remotes should have global identifier added if missing#29811

Merged
Coly010 merged 1 commit intomasterfrom
mf/ensure-mapped-remotes-include-global
Jan 30, 2025
Merged

fix(module-federation): tuple remotes should have global identifier added if missing#29811
Coly010 merged 1 commit intomasterfrom
mf/ensure-mapped-remotes-include-global

Conversation

@Coly010
Copy link
Copy Markdown
Contributor

@Coly010 Coly010 commented Jan 30, 2025

Current Behavior

Our Module Federation Config allows passing tuple remotes:

remotes: [
  ["remote1", "http://localhost:4201/remoteEntry.js"]
]

However, if the Module Federation system is expecting the remotes to be loaded as Global variables in the browser, then we erroneously pass just the url to webpack/rspack's extractUrlAndGlobal method.

This expects a string of format name@url. For non-tuple remote configurations, we create this correctly.
However, when a tuple is passed, we simply return the url.

Expected Behavior

We should ensure that the string is massaged to name@url even when a tuple is provided.

@Coly010 Coly010 requested a review from a team as a code owner January 30, 2025 10:57
@Coly010 Coly010 requested a review from leosvelperez January 30, 2025 10:57
@Coly010 Coly010 self-assigned this Jan 30, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jan 30, 2025 11:05am

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Jan 30, 2025

View your CI Pipeline Execution ↗ for commit 91c05d3.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 29m 8s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 12s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx format:check --base=10c14... ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx documentation --no-dte ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-30 11:37:23 UTC

@Coly010 Coly010 force-pushed the mf/ensure-mapped-remotes-include-global branch from 44c0905 to 91c05d3 Compare January 30, 2025 11:03
@Coly010 Coly010 merged commit 07f1215 into master Jan 30, 2025
@Coly010 Coly010 deleted the mf/ensure-mapped-remotes-include-global branch January 30, 2025 12:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 5, 2025

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants