fix: merge build.rolldownOptions.output.minify correctly - #23536
Merged
sapphi-red merged 4 commits intoSep 30, 2026
Merged
Conversation
hktitof
force-pushed
the
fix/rolldown-output-minify-merge
branch
from
September 22, 2026 14:21
836cb07 to
c97929e
Compare
setting `build.rolldownOptions.output.minify` overrode the whole value instead of being merged, so a partial object dropped the defaults vite computes for es lib builds and lost the codegen: false guard that keeps pure annotations intact for tree shaking move the resolved value after the user spread and merge it like output.comments, a boolean still wins over the computed default and partial objects keep the defaults same invariant as vitejs#23514, applied to output.minify
hktitof
force-pushed
the
fix/rolldown-output-minify-merge
branch
from
September 22, 2026 14:21
c97929e to
a9764c2
Compare
sapphi-red
approved these changes
Sep 30, 2026
Contributor
Author
|
thanks for the approval and the merge @sapphi-red, and for the test cleanups you pushed on the branch, the mangle keepNames value is the correct one and the non null output access reads better than the cast i had. the fix now keeps the resolved minify defaults before the spread and merges the user object on top so the codegen guard survives. happy to follow up if any other rolldown output option needs the same merge shape |
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.
What does this PR solve
setting
build.rolldownOptions.output.minifyoverrode the whole value instead of being merged, the same bugoutput.commentshad before #23514with
build.minify: 'oxc'on an es lib build vite resolves{ compress: true, mangle: true, codegen: false }, the codegen guard is there to keep pure annotations so tree shaking keeps working. a partial user object like{ mangle: { props: true } }replaced it wholesale and silently dropped that guardthe fix moves the resolved value after the user spread and merges it like comments already does, so a boolean still wins over the computed default and partial objects keep the defaults
Tests
added two tests to the existing resolveRolldownOptions block in build.spec.ts
merges a partial output.minify object with the lib defaultsfails on main, the resolved minify comes back withoutcompressandcodegen, and passes with this change.keeps an explicit boolean output.minify untouchedpins that a plainfalsestill wins over the resolved defaultall 70 tests in build.spec.ts pass