File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -669,6 +669,26 @@ describe('mergeConfig', () => {
669669 ) . toBe ( 'browser' )
670670 } )
671671
672+ test ( 'resolved build options keep rollupOptions as a live proxy of rolldownOptions' , async ( ) => {
673+ const config = await resolveConfig ( { } , 'serve' )
674+
675+ for ( const build of [
676+ config . build ,
677+ config . environments . client . build ,
678+ config . environments . ssr . build ,
679+ ] ) {
680+ // Reassigning `rolldownOptions` must be reflected through the `rollupOptions` getter.
681+ const newOptions = { treeshake : false }
682+ build . rolldownOptions = newOptions
683+ expect ( build . rollupOptions ) . toBe ( newOptions )
684+
685+ // Assigning through `rollupOptions` must update `rolldownOptions` too.
686+ const newerOptions = { treeshake : true }
687+ build . rollupOptions = newerOptions
688+ expect ( build . rolldownOptions ) . toBe ( newerOptions )
689+ }
690+ } )
691+
672692 test ( 'syncs `server.hmr.*` to `server.ws.*`' , ( ) => {
673693 const baseConfig = defineConfig ( {
674694 server : {
Original file line number Diff line number Diff line change @@ -505,6 +505,9 @@ export function resolveBuildEnvironmentOptions(
505505 ...merged . modulePreload ,
506506 } ,
507507 }
508+ // The object spread above evaluates the `rollupOptions` getter set up on
509+ // `merged` and copies it as a plain data property.
510+ setupRollupOptionCompat ( resolved , 'build' )
508511
509512 return resolved
510513}
You can’t perform that action at this time.
0 commit comments