Skip to content

Commit 1830fa3

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 0da87bf commit 1830fa3

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
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
@@ -21,7 +21,15 @@ const UNSUPPORTED_OPTIONS: Array<keyof BrowserBuilderOptions> = [
2121
'webWorkerTsConfig',
2222
];
2323

24-
export function logBuilderStatusWarnings(options: BrowserBuilderOptions, context: BuilderContext) {
24+
export function logBuilderStatusWarnings(
25+
options: BrowserBuilderOptions,
26+
{ logger }: BuilderContext,
27+
) {
28+
logger.warn(
29+
`The 'browser-esbuild' builder is a compatibility builder which will be removed in a future major ` +
30+
`version in favor of the 'application' builder.`,
31+
);
32+
2533
// Validate supported options
2634
for (const unsupportedOption of UNSUPPORTED_OPTIONS) {
2735
const value = (options as unknown as BrowserBuilderOptions)[unsupportedOption];
@@ -41,12 +49,12 @@ export function logBuilderStatusWarnings(options: BrowserBuilderOptions, context
4149
unsupportedOption === 'resourcesOutputPath' ||
4250
unsupportedOption === 'deployUrl'
4351
) {
44-
context.logger.warn(
52+
logger.warn(
4553
`The '${unsupportedOption}' option is not used by this builder and will be ignored.`,
4654
);
4755
continue;
4856
}
4957

50-
context.logger.warn(`The '${unsupportedOption}' option is not yet supported by this builder.`);
58+
logger.warn(`The '${unsupportedOption}' option is not yet supported by this builder.`);
5159
}
5260
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { createAngularLocaleDataPlugin } from '../../tools/vite/i18n-locale-plug
2424
import { RenderOptions, renderPage } from '../../utils/server-rendering/render-page';
2525
import { getSupportedBrowsers } from '../../utils/supported-browsers';
2626
import { getIndexOutputFile } from '../../utils/webpack-browser-config';
27+
import { buildApplicationInternal } from '../application';
2728
import { buildEsbuildBrowser } from '../browser-esbuild';
2829
import { Schema as BrowserBuilderOptions } from '../browser-esbuild/schema';
2930
import { loadProxyConfiguration } from './load-proxy-config';
@@ -116,9 +117,15 @@ export async function* serveWithVite(
116117
let listeningAddress: AddressInfo | undefined;
117118
const generatedFiles = new Map<string, OutputFileRecord>();
118119
const assetFiles = new Map<string, string>();
120+
const build =
121+
builderName === '@angular-devkit/build-angular:application'
122+
? buildApplicationInternal
123+
: buildEsbuildBrowser;
124+
119125
// TODO: Switch this to an architect schedule call when infrastructure settings are supported
120-
for await (const result of buildEsbuildBrowser(
121-
browserOptions,
126+
for await (const result of build(
127+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
128+
browserOptions as any,
122129
context,
123130
{
124131
write: false,

0 commit comments

Comments
 (0)