Skip to content

Commit 5c2abff

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. (cherry picked from commit 7b0f697)
1 parent 0eaec23 commit 5c2abff

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ export async function* serveWithVite(
456456
browserOptions.loader as EsbuildLoaderOption | undefined,
457457
{
458458
...browserOptions.define,
459+
'ngJitMode': browserOptions.aot ? 'false' : 'true',
459460
'ngHmrMode': browserOptions.templateUpdates ? 'true' : 'false',
460461
},
461462
extensions?.middleware,

0 commit comments

Comments
 (0)