File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1507,6 +1507,30 @@ describe('resolveConfig', () => {
15071507 expect ( config . environments . ssr . build . rolldownOptions . input ) . toBeUndefined ( )
15081508 } )
15091509
1510+ test ( 'top-level input applies to the SSR environment when build.ssr is true in build' , async ( ) => {
1511+ const config = await resolveConfig (
1512+ {
1513+ input : 'src/entry-server.ts' ,
1514+ build : { ssr : true } ,
1515+ } ,
1516+ 'build' ,
1517+ )
1518+
1519+ expect ( config . environments . ssr . input ) . toBe ( 'src/entry-server.ts' )
1520+ } )
1521+
1522+ test ( 'top-level input does not apply to the SSR environment when build.ssr is true in dev' , async ( ) => {
1523+ const config = await resolveConfig (
1524+ {
1525+ input : 'src/entry-server.ts' ,
1526+ build : { ssr : true } ,
1527+ } ,
1528+ 'serve' ,
1529+ )
1530+
1531+ expect ( config . environments . ssr . input ) . toBeUndefined ( )
1532+ } )
1533+
15101534 test ( 'per-environment input overrides the top-level value' , async ( ) => {
15111535 const config = await resolveConfig (
15121536 {
Original file line number Diff line number Diff line change @@ -1714,6 +1714,10 @@ export async function resolveConfig(
17141714 } ,
17151715 }
17161716
1717+ if ( isBuild && config . build ?. ssr === true ) {
1718+ config . environments . ssr . input ??= config . input
1719+ }
1720+
17171721 for ( const name of Object . keys ( config . environments ) ) {
17181722 config . environments [ name ] = mergeConfig (
17191723 name === 'client'
You can’t perform that action at this time.
0 commit comments