File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
angular_devkit/build_angular/src/tools/webpack/configs
angular/build/src/tools/esbuild Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -507,8 +507,12 @@ export function createSsrEntryCodeBundleOptions(
507
507
function getEsBuildServerCommonOptions ( options : NormalizedApplicationBuildOptions ) : BuildOptions {
508
508
const isNodePlatform = options . ssrOptions ?. platform !== ExperimentalPlatform . Neutral ;
509
509
510
+ const commonOptons = getEsBuildCommonOptions ( options ) ;
511
+ commonOptons . define ??= { } ;
512
+ commonOptons . define [ 'ngServerMode' ] = 'true' ;
513
+
510
514
return {
511
- ...getEsBuildCommonOptions ( options ) ,
515
+ ...commonOptons ,
512
516
platform : isNodePlatform ? 'node' : 'neutral' ,
513
517
outExtension : { '.js' : '.mjs' } ,
514
518
// Note: `es2015` is needed for RxJS v6. If not specified, `module` would
@@ -587,6 +591,7 @@ function getEsBuildCommonOptions(options: NormalizedApplicationBuildOptions): Bu
587
591
// which a constant true value would break.
588
592
...( optimizationOptions . scripts ? { 'ngDevMode' : 'false' } : undefined ) ,
589
593
'ngJitMode' : jit ? 'true' : 'false' ,
594
+ 'ngServerMode' : 'false' ,
590
595
} ,
591
596
loader : loaderExtensions ,
592
597
footer,
Original file line number Diff line number Diff line change @@ -299,7 +299,10 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
299
299
if ( scriptsOptimization ) {
300
300
extraMinimizers . push (
301
301
new JavaScriptOptimizerPlugin ( {
302
- define : buildOptions . aot ? GLOBAL_DEFS_FOR_TERSER_WITH_AOT : GLOBAL_DEFS_FOR_TERSER ,
302
+ define : {
303
+ ...( buildOptions . aot ? GLOBAL_DEFS_FOR_TERSER_WITH_AOT : GLOBAL_DEFS_FOR_TERSER ) ,
304
+ 'ngServerMode' : isPlatformServer ,
305
+ } ,
303
306
sourcemap : scriptsSourceMap ,
304
307
supportedBrowsers : buildOptions . supportedBrowsers ,
305
308
keepIdentifierNames : ! allowMangle || isPlatformServer ,
You can’t perform that action at this time.
0 commit comments