Repository navigation
fix(bundler): include CSS in all HTML entrypoints sharing a deduplicated CSS chunk - #27040
Conversation
|
Updated 2:17 AM PT - Feb 15th, 2026
❌ Your commit
🧪 To try this PR locally: bunx bun-pr 27040That installs a local version of the PR into your bun-27040 --bun |
WalkthroughResolve CSS deduplication and HTML linking: CSS chunk lookup for HTML now prefers the related JS chunk's Changes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 Comment |
…ted CSS chunk When multiple HTML entrypoints shared the same CSS file with `--production`, only the first HTML file included the `<link>` tag. This was caused by two issues: 1. `getCSSChunkForHTML` matched CSS chunks by `entry_point_id`, but deduplicated CSS chunks only stored the first entry point's ID. Fixed by looking up CSS chunks through the JS chunk's `css_chunks` indices instead. 2. The CSS chunk index remapping used `js_chunks.count()` as the starting offset, which didn't account for HTML chunks interleaved with JS chunks in the sorted array. Fixed by using `sorted_chunks.len` instead. Closes #23668 Co-Authored-By: Claude <noreply@anthropic.com>
630f8b2 to
d1a0e9a
Compare
Code ReviewNewest first ✅ 630f8 — Looks good! Reviewed 3 files across Powered by Claude Code Review |
Code ReviewNewest first ✅ d1a0e — Looks good! Reviewed 10 files across Powered by Claude Code Review |
…oints Use content-based hashing for CSS chunk deduplication even when css_chunking is disabled. This prevents "Multiple files share the same output path" errors when multiple JS entry points import the same CSS and hash-based entry naming is used. Unskips the css/MetafileCSSBundleTwoToOne test. Co-Authored-By: Claude <noreply@anthropic.com>
Code ReviewNewest first ✅ f0cae — Looks good! Reviewed 2 files across Powered by Claude Code Review |
Summary
--productionflag is used, CSS is not included correctly when there are multiple html entrypoints #23668: When multiple HTML entrypoints shared the same CSS file with--production, only the first HTML file included the<link>tag for CSS. The second (and subsequent) entrypoints were missing it entirely.getCSSChunkForHTMLmatched byentry_point_id, but deduplicated CSS chunks only stored the first entry point's ID. Fixed by resolving CSS chunks through the JS chunk'scss_chunksindices.computeChunksusedjs_chunks.count()as the base offset, not accounting for interleaved HTML chunks. Fixed by usingsorted_chunks.len.Test plan
html/SharedCSSProductionMultipleEntriesintest/bundler/bundler_html.test.ts— verifies both HTML entrypoints get CSS<link>tags pointing to the same deduplicated CSS chunkUSE_SYSTEM_BUN=1(reproduces the bug) and passes with debug build (confirms the fix)🤖 Generated with Claude Code