From b63e0df1f760c1b38ec7e9e553ed5f8e68548274 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:43:50 -0400 Subject: [PATCH] refactor(@angular/build): allow development server `buildTarget` option to be optional The development server (`dev-server`) within `@angular/build` no longer requires a `buildTarget` option to be specified. If not present, the value will default to the current project's 'build' target. The configuration used for the build target will be the same as the development server configuration if specified or, if not specified, it will default to `development`. --- packages/angular/build/src/builders/dev-server/options.ts | 6 ++++-- packages/angular/build/src/builders/dev-server/schema.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/angular/build/src/builders/dev-server/options.ts b/packages/angular/build/src/builders/dev-server/options.ts index 080e168699bc..e342416e0695 100644 --- a/packages/angular/build/src/builders/dev-server/options.ts +++ b/packages/angular/build/src/builders/dev-server/options.ts @@ -36,8 +36,10 @@ export async function normalizeOptions( const cacheOptions = normalizeCacheOptions(projectMetadata, workspaceRoot); - // Target specifier defaults to the current project's build target using a development configuration - const buildTargetSpecifier = options.buildTarget ?? `::development`; + // Target specifier defaults to the current project's build target using the provided dev-server + // configuration if a configuration is present or the 'development' configuration if not. + const buildTargetSpecifier = + options.buildTarget ?? `::${context.target?.configuration || 'development'}`; const buildTarget = targetFromTargetString(buildTargetSpecifier, projectName, 'build'); // Get the application builder options. diff --git a/packages/angular/build/src/builders/dev-server/schema.json b/packages/angular/build/src/builders/dev-server/schema.json index 3adce45eb71a..8bc0fc4dc4ff 100644 --- a/packages/angular/build/src/builders/dev-server/schema.json +++ b/packages/angular/build/src/builders/dev-server/schema.json @@ -111,5 +111,5 @@ } }, "additionalProperties": false, - "required": ["buildTarget"] + "required": [] }