Skip to content

fix: handle circular SSR module graphs#916

Merged
gioboa merged 2 commits into
module-federation:mainfrom
tonoizer:codex/fix-ssr-circular-graph
Jul 14, 2026
Merged

fix: handle circular SSR module graphs#916
gioboa merged 2 commits into
module-federation:mainfrom
tonoizer:codex/fix-ssr-circular-graph

Conversation

@tonoizer

Copy link
Copy Markdown
Contributor

Summary

  • reserve deterministic temp-file paths before traversing remote SSR imports
  • avoid awaiting an ancestor's in-flight fetch when an ESM graph contains a cycle
  • wait for every discovered module writer before importing the completed graph
  • clear reserved path entries together with the existing SSR loader cache

Testing

  • pnpm typecheck
  • pnpm fmt.check
  • pnpm test (746 passed, 1 skipped)
  • pnpm build
  • packaged-loader reproduction: a two-module circular SSR graph resolves instead of timing out

Risks

  • The change is scoped to the HTTP-to-temp-file SSR loading strategy. It preserves existing deterministic filenames and cache keys, but changes in-flight cache hits to use a reserved destination path so circular graphs can complete.

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@module-federation/vite@916

commit: 8a5c489

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tests With Different Frameworks

Image

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@tonoizer that's awesome 💪 Thank you

@gioboa gioboa merged commit ef9ae46 into module-federation:main Jul 14, 2026
19 checks passed
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.

2 participants