@@ -390,8 +390,6 @@ export function resolveBuildEnvironmentOptions(
390
390
raw : BuildEnvironmentOptions ,
391
391
logger : Logger ,
392
392
consumer : 'client' | 'server' | undefined ,
393
- // Backward compatibility
394
- isSsrTargetWebworkerEnvironment ?: boolean ,
395
393
) : ResolvedBuildEnvironmentOptions {
396
394
const deprecatedPolyfillModulePreload = raw ?. polyfillModulePreload
397
395
const { polyfillModulePreload, ...rest } = raw
@@ -453,19 +451,6 @@ export function resolveBuildEnvironmentOptions(
453
451
} ,
454
452
}
455
453
456
- if ( isSsrTargetWebworkerEnvironment ) {
457
- resolved . rollupOptions ??= { }
458
- resolved . rollupOptions . output ??= { }
459
- const output = resolved . rollupOptions . output
460
- for ( const out of arraify ( output ) ) {
461
- out . entryFileNames ??= `[name].js`
462
- out . chunkFileNames ??= `[name]-[hash].js`
463
- const input = resolved . rollupOptions . input
464
- out . inlineDynamicImports ??=
465
- ! input || typeof input === 'string' || Object . keys ( input ) . length === 1
466
- }
467
- }
468
-
469
454
return resolved
470
455
}
471
456
@@ -677,6 +662,10 @@ async function buildEnvironment(
677
662
logger . error ( e . message , { error : e } )
678
663
}
679
664
665
+ const isSsrTargetWebworkerEnvironment =
666
+ environment . name === 'ssr' &&
667
+ environment . getTopLevelConfig ( ) . ssr ?. target === 'webworker'
668
+
680
669
let bundle : RollupBuild | undefined
681
670
let startTime : number | undefined
682
671
try {
@@ -706,7 +695,7 @@ async function buildEnvironment(
706
695
707
696
const format = output . format || 'es'
708
697
const jsExt =
709
- environment . config . consumer === 'server' || libOptions
698
+ ( ssr && ! isSsrTargetWebworkerEnvironment ) || libOptions
710
699
? resolveOutputJsExtension (
711
700
format ,
712
701
findNearestPackageData ( root , packageCache ) ?. data . type ,
@@ -744,7 +733,10 @@ async function buildEnvironment(
744
733
? `[name].[ext]`
745
734
: path . posix . join ( options . assetsDir , `[name]-[hash].[ext]` ) ,
746
735
inlineDynamicImports :
747
- output . format === 'umd' || output . format === 'iife' ,
736
+ output . format === 'umd' ||
737
+ output . format === 'iife' ||
738
+ ( isSsrTargetWebworkerEnvironment &&
739
+ ( typeof input === 'string' || Object . keys ( input ) . length === 1 ) ) ,
748
740
...output ,
749
741
}
750
742
}
0 commit comments