Skip to content

fix downstream lazy entry classification - #266

Closed
brenelz wants to merge 1 commit into
nextfrom
fix/downstream-lazy-entry-classification
Closed

fix downstream lazy entry classification#266
brenelz wants to merge 1 commit into
nextfrom
fix/downstream-lazy-entry-classification

Conversation

@brenelz

@brenelz brenelz commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Reclassify emitted lazy() facade chunks in the raw Rollup output bundle so downstream plugins do not mistake them for application entry points.

Problem

SSR-mode client builds emit dynamically imported project modules as explicit facade chunks. This ensures each lazy module receives a stable manifest entry, but Rollup can mark those emitted chunks as isEntry: true even though they are dynamically imported by another chunk.

vite-plugin-solid already corrects this classification when loading the serialized Vite manifest. However, plugins that inspect the raw output bundle during generateBundle run before that correction and can observe multiple apparent application entries.

For example, TanStack Start's client manifest plugin failed on Linux with:

Error: multiple entries detected: assets/index-*.js assets/routes-*.js

The index chunk is the actual client entry, while the routes chunk is an emitted lazy facade.

Fix

Run the existing normalizeEmittedLazyEntries helper from generateBundle as well as when loading the serialized manifest.

This changes chunks that are both:

  • marked as entries; and
  • dynamically imported by another chunk

from isEntry to isDynamicEntry before downstream output hooks inspect the bundle. The real client entry remains unchanged.

Verification

  • pnpm build
  • Confirmed the generated ESM and CJS packages compile successfully

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8095fc7

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

This PR includes changesets to release 1 package
Name Type
vite-plugin-solid 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

@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/vite-plugin-solid@266

commit: 8095fc7

ryansolid added a commit that referenced this pull request Jul 14, 2026
Downstream plugins inspecting the client bundle in generateBundle (and
Vite's manifest plugin serializing it) saw lazy facade chunks marked
isEntry, mistaking them for application entries. Apply the existing
reclassification to the Rollup bundle itself, ahead of the client asset
map build. Ports the fix from #266.

Co-authored-by: Brenley Dueck <brenleydueck@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ryansolid

Copy link
Copy Markdown
Member

Thanks @brenelz — this was a real gap and your diagnosis was right on. next moved quite a bit since you branched (the generateBundle hook now also builds the client asset map, and entry detection changed for builder-mode multi-environment builds), so rather than wait on a rebase I folded your fix into the current hook directly: the bundle-side normalizeEmittedLazyEntries call now runs ahead of the client asset map build, and your changeset ships verbatim.

Landed in 36428cb with you as co-author, so the credit is preserved in the history and the changelog. Closing this one out — thanks again for the contribution!

@ryansolid ryansolid closed this Jul 14, 2026
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