Repository navigation
fix(css): dedupe CSS of inlined common chunks when cssCodeSplit: false - #24168
Merged
Merged
Conversation
hyfdev
force-pushed
the
fix/css-single-bundle-dedupe
branch
from
November 20, 2026 14:58
4259140 to
2db20b8
Compare
Rolldown's `experimentalInlineCommonChunks` copies a common chunk into every chunk that imports it, and each of those chunks lists the copied modules. With `cssCodeSplit: false`, Vite builds the single CSS file from the CSS of every chunk, so a copied style module's CSS was added once per copy, and a later copy overrode the rules placed after the first one. Vite now adds each style module's CSS once, where it first appears.
hyfdev
force-pushed
the
fix/css-single-bundle-dedupe
branch
from
November 20, 2026 15:17
2db20b8 to
dca06be
Compare
cssCodeSplit: falsecssCodeSplit: false
hyfdev
force-pushed
the
fix/css-single-bundle-dedupe
branch
3 times, most recently
from
November 24, 2026 01:08
5333003 to
dca06be
Compare
hyfdev
marked this pull request as ready for review
November 24, 2026 01:44
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
sapphi-red
approved these changes
Nov 25, 2026
sapphi-red
left a comment
Member
There was a problem hiding this comment.
(I've refactored to use { content: string, moduleId: string } consistently)
This was referenced Nov 25, 2026
phbaer
pushed a commit
to phbaer/dtvp
that referenced
this pull request
Nov 27, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [vite](https://vite.dev) ([source](https://github.com/vitejs/vite/tree/HEAD/packages/vite)) | devDependencies | minor | [`8.3.8` → `8.4.0`](https://renovatebot.com/diffs/npm/vite/8.3.8/8.4.0) | --- ### Release Notes <details> <summary>vitejs/vite (vite)</summary> ### [`v8.4.0`](https://github.com/vitejs/vite/blob/HEAD/packages/vite/CHANGELOG.md#840-2026-11-26) [Compare Source](vitejs/vite@v8.3.8...v8.4.0) ##### Features - add plugin name to hook errors ([#​24107](vitejs/vite#24107)) ([40475e5](vitejs/vite@40475e5)) - add plugin name to module hook errors ([#​24151](vitejs/vite#24151)) ([e1e1ac8](vitejs/vite@e1e1ac8)) - add `environment.addSafeModule` ([#​23974](vitejs/vite#23974)) ([e0fe98a](vitejs/vite@e0fe98a)) - add `server.fs.strict: 'extended'` ([#​23972](vitejs/vite#23972)) ([e4babd7](vitejs/vite@e4babd7)) - **build:** include worker chunks in manifest ([#​23699](vitejs/vite#23699)) ([bc6e03c](vitejs/vite@bc6e03c)) - **build:** support retrying failed CSS preloads ([#​23710](vitejs/vite#23710)) ([2155e12](vitejs/vite@2155e12)) - **cli:** omit `-0` suffix from the first profile file name ([#​23490](vitejs/vite#23490)) ([c64ba40](vitejs/vite@c64ba40)) - **css:** skip emitting empty CSS files ([#​24059](vitejs/vite#24059)) ([c5be55f](vitejs/vite@c5be55f)) - **css:** support subpath imports in CSS `url()` ([#​23869](vitejs/vite#23869)) ([c110663](vitejs/vite@c110663)) - **environment:** expose build manifest on build environment ([#​23292](vitejs/vite#23292)) ([4db9844](vitejs/vite@4db9844)) - migrate to `dev.sourcemap.css` from `css.devSourcemap` ([#​23765](vitejs/vite#23765)) ([76cb51b](vitejs/vite@76cb51b)) - **module-runner:** align stacktrace with v8 ([#​23690](vitejs/vite#23690)) ([bd32fea](vitejs/vite@bd32fea)) - **preview:** serve wasm compressed ([#​24051](vitejs/vite#24051)) ([39d63b8](vitejs/vite@39d63b8)) - register more references to safe modules ([#​23168](vitejs/vite#23168)) ([e258ce1](vitejs/vite@e258ce1)) - register references in HTML to safe modules ([#​23169](vitejs/vite#23169)) ([ef30399](vitejs/vite@ef30399)) - separate `safeModulePaths` per environment ([#​23973](vitejs/vite#23973)) ([7480c54](vitejs/vite@7480c54)) - show running process for the same project ([#​23624](vitejs/vite#23624)) ([3e1a86e](vitejs/vite@3e1a86e)) - stabilize `--configLoader` and deprecate `--configLoader=runner` ([#​23714](vitejs/vite#23714)) ([e719122](vitejs/vite@e719122)) - support bundled dev mode in ssr ([#​21626](vitejs/vite#21626)) ([5ff255e](vitejs/vite@5ff255e)) - **wasm:** support source phase imports ([#​22675](vitejs/vite#22675)) ([97bb00f](vitejs/vite@97bb00f)) ##### Bug Fixes - close server on failed start (fix [#​23965](vitejs/vite#23965)) ([#​24020](vitejs/vite#24020)) ([c732677](vitejs/vite@c732677)) - **css:** dedupe CSS of inlined common chunks when `cssCodeSplit: false` ([#​24168](vitejs/vite#24168)) ([1b34d86](vitejs/vite@1b34d86)) - **deps:** update all non-major dependencies ([#​24190](vitejs/vite#24190)) ([87d8a5a](vitejs/vite@87d8a5a)) - **dev:** register references to safe modules only for `server.fs.strict: 'extended'` ([#​24206](vitejs/vite#24206)) ([a78fb8a](vitejs/vite@a78fb8a)) - **html:** keep entry script side effects when another importer loads it first ([#​24135](vitejs/vite#24135)) ([ef295d5](vitejs/vite@ef295d5)) - keep plugin error messages as thrown ([#​24148](vitejs/vite#24148)) ([24eb35a](vitejs/vite@24eb35a)) - **optimizer:** detect in-place patch file edits in lockfile hash ([#​24126](vitejs/vite#24126)) ([d7dfe9b](vitejs/vite@d7dfe9b)) - **optimizer:** respect top-level tsconfig option when scanning and bundling deps ([#​24119](vitejs/vite#24119)) ([760a953](vitejs/vite@760a953)) - preserve drive letter case in `safeRealpathSync` on Windows ([#​24146](vitejs/vite#24146)) ([3567471](vitejs/vite@3567471)) - **server:** allow closing uninitialized `DevEnvironment` ([#​24184](vitejs/vite#24184)) ([826dcb8](vitejs/vite@826dcb8)) - **server:** keep `this.addWatchFile` in `load` hook on a module's first request ([#​23861](vitejs/vite#23861)) ([b516bc2](vitejs/vite@b516bc2)) - **build:** keep `magicString` and `ast` in transform hook meta ([#​24067](vitejs/vite#24067)) ([c0d590d](vitejs/vite@c0d590d)) - **bundled-dev:** load lazy chunks under `base` ([#​23798](vitejs/vite#23798)) ([d5c79c7](vitejs/vite@d5c79c7)) - **client:** fallback to waiting on main thread for server start when trusted types are enforced ([#​21483](vitejs/vite#21483)) ([2dcd391](vitejs/vite@2dcd391)) - **css:** match pure css chunk imports by relative path ([#​24105](vitejs/vite#24105)) ([76f9618](vitejs/vite@76f9618)) - **css:** no-externalize by default even for SSR ([#​24075](vitejs/vite#24075)) ([f898888](vitejs/vite@f898888)) - **deps:** update all non-major dependencies ([#​24103](vitejs/vite#24103)) ([c11a671](vitejs/vite@c11a671)) - **deps:** update rolldown-related dependencies ([#​24028](vitejs/vite#24028)) ([a1b813b](vitejs/vite@a1b813b)) - **deps:** update rolldown-related dependencies ([#​24104](vitejs/vite#24104)) ([1404166](vitejs/vite@1404166)) - escape import specifiers ([#​24074](vitejs/vite#24074)) ([9bf5965](vitejs/vite@9bf5965)) - escape imported name in `transformCjsImport` ([#​24080](vitejs/vite#24080)) ([0512d78](vitejs/vite@0512d78)) ##### Performance Improvements - **build:** shift source maps for preload rewrites instead of re-tracing them ([#​24049](vitejs/vite#24049)) ([dbce0c6](vitejs/vite@dbce0c6)) - **build:** skip build import analysis hooks for unaffected chunks ([#​24150](vitejs/vite#24150)) ([1a06564](vitejs/vite@1a06564)) - **build:** skip terser plugin when terser is not used ([#​24149](vitejs/vite#24149)) ([3bde8ed](vitejs/vite@3bde8ed)) - use native binary for getting process start time on windows ([#​24087](vitejs/vite#24087)) ([4bf4f32](vitejs/vite@4bf4f32)) ##### Documentation - replace stale esbuild references in option JSDoc ([#​24196](vitejs/vite#24196)) ([0a19968](vitejs/vite@0a19968)) ##### Miscellaneous Chores - **css:** fix typo in `preliminaryNameToChunkMap` ([#​24195](vitejs/vite#24195)) ([3eabee5](vitejs/vite@3eabee5)) - add debug log when falling back to powershell for process start time ([#​24090](vitejs/vite#24090)) ([880f1cf](vitejs/vite@880f1cf)) - **deps:** update dependency es-module-lexer to v3 ([#​23603](vitejs/vite#23603)) ([785b0ad](vitejs/vite@785b0ad)) ##### Code Refactoring - **build:** skip license plugin via applyToEnvironment when disabled ([#​24134](vitejs/vite#24134)) ([3c22583](vitejs/vite@3c22583)) - simplify some conditions ([#​24125](vitejs/vite#24125)) ([a379269](vitejs/vite@a379269)) - **bundled-dev:** serve the rolldown dev runtime as a single file ([#​23587](vitejs/vite#23587)) ([69df8ad](vitejs/vite@69df8ad)) - drop unused capture groups in test-only regexes ([#​24097](vitejs/vite#24097)) ([2decae3](vitejs/vite@2decae3)) - remove `optimizeDeps.rollupOptions` ([#​23760](vitejs/vite#23760)) ([0651e2c](vitejs/vite@0651e2c)) ##### Build System - look up dts identifier replacements by imported name ([#​24068](vitejs/vite#24068)) ([f60fac3](vitejs/vite@f60fac3)) ##### Beta Changelogs ##### [8.4.0-beta.2](vitejs/vite@v8.4.0-beta.1...v8.4.0-beta.2) (2026-11-25) See [8.4.0-beta.2 changelog](https://github.com/vitejs/vite/blob/v8.4.0-beta.2/packages/vite/CHANGELOG.md) ##### [8.4.0-beta.1](vitejs/vite@v8.3.8...v8.4.0-beta.1) (2026-11-16) See [8.4.0-beta.1 changelog](https://github.com/vitejs/vite/blob/v8.4.0-beta.1/packages/vite/CHANGELOG.md) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMzUuMyIsInVwZGF0ZWRJblZlciI6IjQ0LjIzNS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.baer.one/phbaer/dtvp/pulls/371
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
build.cssCodeSplit: falseand Rolldown'sexperimentalInlineCommonChunks, the single CSS file can contain a shared module's CSS more than once, and a later copy can override rules that should win over it.This PR adds each module's CSS to the file once, where it first appears.
For example,
a.jsandb.jsare entries:Before, the CSS file has a second copy of
shared.cssaftera.css, so.sharedis red:After:
experimentalInlineCommonChunkscopies a small common chunk into each chunk that imports it, and each of those chunks lists the copied modules in itsmodules. Vite builds the CSS file from those lists.resolveAssetUrlsInCsstakes a chunk's CSS as a list of modules and resolves it in one pass, sorenderBuiltUrlandassetFileNamesget the same calls, in the same order, as with the chunk's CSS as one string.Without
experimentalInlineCommonChunks, each module is in exactly one chunk, so the output doesn't change.With
cssCodeSplit: true, each chunk's CSS includes the copied CSS, which that chunk needs, so this PR doesn't change it.Part of rolldown/backlog#22