File tree Expand file tree Collapse file tree 2 files changed +59
-1
lines changed Expand file tree Collapse file tree 2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -556,6 +556,64 @@ describe('mergeConfig', () => {
556
556
expect ( upOutput . hashCharacters ) . toBe ( 'base36' )
557
557
expect ( downOutput . hashCharacters ) . toBe ( 'base36' )
558
558
} )
559
+
560
+ test ( 'rollupOptions/rolldownOptions.platform' , async ( ) => {
561
+ const testRollupOptions = await resolveConfig (
562
+ {
563
+ plugins : [
564
+ {
565
+ name : 'set-rollupOptions-platform' ,
566
+ configEnvironment ( name ) {
567
+ if ( name === 'ssr' ) {
568
+ return {
569
+ build : {
570
+ rollupOptions : {
571
+ platform : 'neutral' ,
572
+ } ,
573
+ } ,
574
+ }
575
+ }
576
+ } ,
577
+ } ,
578
+ ] ,
579
+ } ,
580
+ 'serve' ,
581
+ )
582
+ expect (
583
+ testRollupOptions . environments . ssr . build . rolldownOptions . platform ,
584
+ ) . toBe ( 'neutral' )
585
+ expect (
586
+ testRollupOptions . environments . client . build . rolldownOptions . platform ,
587
+ ) . toBe ( 'browser' )
588
+
589
+ const testRolldownOptions = await resolveConfig (
590
+ {
591
+ plugins : [
592
+ {
593
+ name : 'set-rollupOptions-platform' ,
594
+ configEnvironment ( name ) {
595
+ if ( name === 'ssr' ) {
596
+ return {
597
+ build : {
598
+ rolldownOptions : {
599
+ platform : 'neutral' ,
600
+ } ,
601
+ } ,
602
+ }
603
+ }
604
+ } ,
605
+ } ,
606
+ ] ,
607
+ } ,
608
+ 'serve' ,
609
+ )
610
+ expect (
611
+ testRolldownOptions . environments . ssr . build . rolldownOptions . platform ,
612
+ ) . toBe ( 'neutral' )
613
+ expect (
614
+ testRolldownOptions . environments . client . build . rolldownOptions . platform ,
615
+ ) . toBe ( 'browser' )
616
+ } )
559
617
} )
560
618
561
619
describe ( 'resolveEnvPrefix' , ( ) => {
Original file line number Diff line number Diff line change @@ -438,8 +438,8 @@ export function resolveBuildEnvironmentOptions(
438
438
)
439
439
setupRollupOptionCompat ( merged )
440
440
merged . rolldownOptions = {
441
- ...merged . rolldownOptions ,
442
441
platform : consumer === 'server' ? 'node' : 'browser' ,
442
+ ...merged . rolldownOptions ,
443
443
}
444
444
445
445
// handle special build targets
You can’t perform that action at this time.
0 commit comments