Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 700e6bc

Browse files
committed
fix(@angular-devkit/build-angular): avoid extra tick in SSR 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 4af3852 commit 700e6bc

File tree

1 file changed

+12
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/server

1 file changed

+12
-1
lines changed

packages/angular_devkit/build_angular/src/builders/server/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,18 @@ async function initialize(
212212
wco.buildOptions.supportedBrowsers ??= [];
213213
wco.buildOptions.supportedBrowsers.push(...browserslist('maintained node versions'));
214214

215-
return [getPlatformServerExportsConfig(wco), getCommonConfig(wco), getStylesConfig(wco)];
215+
return [
216+
getPlatformServerExportsConfig(wco),
217+
getCommonConfig(wco),
218+
getStylesConfig(wco),
219+
{
220+
plugins: [
221+
new webpack.DefinePlugin({
222+
'ngJitMode': false,
223+
}),
224+
],
225+
},
226+
];
216227
},
217228
);
218229

0 commit comments

Comments
 (0)