Skip to content

Commit cf95870

Browse files
committed
refactor: add warning when using browser-esbuild
This commits add a warning when using the browser-esbuild builder which eventually will be removed in favor of the `application` builder.
1 parent b5a8174 commit cf95870

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/builder-status-warnings.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ const UNSUPPORTED_OPTIONS: Array<keyof BrowserBuilderOptions> = [
2424
'webWorkerTsConfig',
2525
];
2626

27-
export function logBuilderStatusWarnings(options: BrowserBuilderOptions, context: BuilderContext) {
27+
export function logBuilderStatusWarnings(
28+
options: BrowserBuilderOptions,
29+
{ logger }: BuilderContext,
30+
) {
31+
logger.warn(
32+
`The 'browser-esbuild' builder is a compatibility builder which will be removed in a future major ` +
33+
`version in favor of the 'application' builder.`,
34+
);
35+
2836
// Validate supported options
2937
for (const unsupportedOption of UNSUPPORTED_OPTIONS) {
3038
const value = (options as unknown as BrowserBuilderOptions)[unsupportedOption];
@@ -44,12 +52,12 @@ export function logBuilderStatusWarnings(options: BrowserBuilderOptions, context
4452
unsupportedOption === 'resourcesOutputPath' ||
4553
unsupportedOption === 'deployUrl'
4654
) {
47-
context.logger.warn(
55+
logger.warn(
4856
`The '${unsupportedOption}' option is not used by this builder and will be ignored.`,
4957
);
5058
continue;
5159
}
5260

53-
context.logger.warn(`The '${unsupportedOption}' option is not yet supported by this builder.`);
61+
logger.warn(`The '${unsupportedOption}' option is not yet supported by this builder.`);
5462
}
5563
}

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { createAngularLocaleDataPlugin } from '../../tools/vite/i18n-locale-plug
2323
import { RenderOptions, renderPage } from '../../utils/server-rendering/render-page';
2424
import { getSupportedBrowsers } from '../../utils/supported-browsers';
2525
import { getIndexOutputFile } from '../../utils/webpack-browser-config';
26+
import { buildApplicationInternal } from '../application';
2627
import { buildEsbuildBrowser } from '../browser-esbuild';
2728
import { Schema as BrowserBuilderOptions } from '../browser-esbuild/schema';
2829
import { loadProxyConfiguration } from './load-proxy-config';
@@ -114,8 +115,14 @@ export async function* serveWithVite(
114115
let listeningAddress: AddressInfo | undefined;
115116
const generatedFiles = new Map<string, OutputFileRecord>();
116117
const assetFiles = new Map<string, string>();
118+
const build =
119+
builderName === '@angular-devkit/build-angular:application'
120+
? buildApplicationInternal
121+
: buildEsbuildBrowser;
122+
117123
// TODO: Switch this to an architect schedule call when infrastructure settings are supported
118-
for await (const result of buildEsbuildBrowser(browserOptions, context, {
124+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
125+
for await (const result of build(browserOptions as any, context, {
119126
write: false,
120127
})) {
121128
assert(result.outputFiles, 'Builder did not provide result files.');

0 commit comments

Comments
 (0)