Skip to content

Commit 7b0f697

Browse files
committed
fix(@angular/build): avoid extra tick in SSR dev-server builds
In SSR applications, an unnecessary event loop tick during server startup could lead to an incorrect platform being initialized. This change introduces an `ngJitMode` define, which is set to `false` during AOT builds. This allows for the JIT-specific code paths to not be followed, preventing the async operations that caused the extra tick. This ensures that the server platform is correctly and synchronously initialized.
1 parent e417c89 commit 7b0f697

File tree

1 file changed

+1
-0
lines changed
  • packages/angular/build/src/builders/dev-server/vite

1 file changed

+1
-0
lines changed

packages/angular/build/src/builders/dev-server/vite/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ export async function* serveWithVite(
436436
browserOptions.loader as EsbuildLoaderOption | undefined,
437437
{
438438
...browserOptions.define,
439+
'ngJitMode': browserOptions.aot ? 'false' : 'true',
439440
'ngHmrMode': browserOptions.templateUpdates ? 'true' : 'false',
440441
},
441442
extensions?.middleware,

0 commit comments

Comments
 (0)