Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): emit error when using prerender a…
Browse files Browse the repository at this point in the history
…nd app-shell builders with application builder

The application builder has built-in prerendering and app-shell generation capabilities which makes using these builders redundant.
  • Loading branch information
alan-agius4 authored and clydin committed Dec 26, 2023
1 parent 140a5f5 commit 49ed9a2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ async function _appShellBuilder(
serviceWorker: false,
optimization: optimization as unknown as JsonObject,
});

if (browserTargetRun.info.builderName === '@angular-devkit/build-angular:application') {
return {
success: false,
error:
'"@angular-devkit/build-angular:application" has built-in app-shell generation capabilities. ' +
'The "appShell" option should be used instead.',
};
}

const serverTargetRun = await context.scheduleTarget(serverTarget, {
watch: false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ async function _scheduleBuilds(
serviceWorker: false,
// todo: handle service worker augmentation
});

if (browserTargetRun.info.builderName === '@angular-devkit/build-angular:application') {
return {
success: false,
error:
'"@angular-devkit/build-angular:application" has built-in prerendering capabilities. ' +
'The "prerender" option should be used instead.',
};
}

const serverTargetRun = await context.scheduleTarget(serverTarget, {
watch: false,
});
Expand Down

0 comments on commit 49ed9a2

Please sign in to comment.