Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: reuse shared cache before loading#883

Merged
gioboa merged 2 commits into
mainfrom
fix/881
Jul 7, 2026
Merged

fix: reuse shared cache before loading#883
gioboa merged 2 commits into
mainfrom
fix/881

Conversation

@gioboa

@gioboa gioboa commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Close #881

Make singleton shared fallback lazy during build and reuse cached shared modules before importing local providers, preventing duplicate downloads.

@pkg-pr-new

pkg-pr-new Bot commented Jul 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: c0f9088

@gioboa gioboa force-pushed the fix/881 branch 4 times, most recently from 94c014a to 725b946 Compare July 7, 2026 14:51
@dmchoi77

dmchoi77 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Hi! @gioboa One thing I’m wondering about from the CI results:

Vite 5/6/7 integration passes, but Vite 8 fails because it cannot find the localSharedImportMap chunk.

The Playwright trace also shows the browser trying to fetch virtual:mf-REMOTE_ENTRY_ID:... directly, which then fails with CORS / net::ERR_FAILED.

Could this be caused by a behavior difference in how Vite 8/Rolldown handles import(/* @vite-ignore */ "virtual:...") compared to Vite 5/6/7?

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@dmchoi77 Thanks for your check
This is not a simple fix, the pipeline with all the frameworks is failing as well 🥲

@gioboa gioboa changed the title fix: prevent redundant shared fallback downloads fix: reuse shared cache before loading Jul 7, 2026

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator Author

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 merged commit 909d84e into main Jul 7, 2026
22 checks passed
@gioboa gioboa deleted the fix/881 branch July 7, 2026 21:22
gioboa added a commit that referenced this pull request Jul 11, 2026
* fix: seed subpath shares before their package root

Since the runtime shared cache seeding (#883), serve-mode share proxies no
longer bind an eager local fallback: on a cache miss they defer export
assignment until after federation init. The seed loop iterated usedShared in
insertion (alphabetical) order, so seeding a package root evaluated its module
graph while the package's own subpath shares were still unseeded — a
self-referencing bare import like `import { builder } from 'pkg/api'` inside
`pkg` then read undefined named exports at module-evaluation time and crashed
consumers (same failure family as #767 and #805, now in dev serve).

Seed shares in dependency order instead, treating a package's subpath share
keys as dependencies of the package root, with a runtime fallback for share
keys discovered after codegen.

Co-Authored-By: Claude Fable 5 <[email protected]>

* test: add late share ordering regression test

* chore: improve code

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: gioboa <[email protected]>
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.

[Bug]: Shared dependencies are downloaded again, even when the share scope already contains them

2 participants