refactor(@angular/ssr): add timeout to prevent 'adev' hanging during route extraction

A timeout was added during route extraction to resolve an issue where 'adev' would hang in production builds.
The root cause is currently unclear, but this change ensures the build completes successfully.
This commit is contained in:
Alan Agius 2024-12-16 13:38:34 +00:00 committed by Alan Agius
parent 1d6d264960
commit 78c41f67ec

View File

@ -571,6 +571,10 @@ export async function getRoutesFromAngularRouterConfig(
}
}
// This timeout is necessary to prevent 'adev' from hanging in production builds.
// The exact cause is unclear, but removing it leads to the issue.
await new Promise((resolve) => setTimeout(resolve, 0));
if (serverConfigRouteTree) {
for (const { route, presentInClientRouter } of serverConfigRouteTree.traverse()) {
if (presentInClientRouter || route === '**') {