From 90c2e00c2cc721e7bb972a72d18f3c6c2673f6b9 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Wed, 19 Mar 2025 19:21:09 -0400 Subject: [PATCH] feat(@angular/build): support a default outputPath option for applications The application builder will now use a default output path when the `outputPath` option is not specified either in the `angular.json` configuration or via the command line. The default used will be `dist/` and be relative to the workspace root. This value is the typical default for new projects. Projects may continue to customize the output path via the option if needed. Existing project behavior and configuration will not be changed. --- goldens/public-api/angular/build/index.api.md | 2 +- packages/angular/build/src/builders/application/options.ts | 2 +- packages/angular/build/src/builders/application/schema.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/goldens/public-api/angular/build/index.api.md b/goldens/public-api/angular/build/index.api.md index 79240b301679..3e0a2578ed12 100644 --- a/goldens/public-api/angular/build/index.api.md +++ b/goldens/public-api/angular/build/index.api.md @@ -49,7 +49,7 @@ export type ApplicationBuilderOptions = { optimization?: OptimizationUnion; outputHashing?: OutputHashing; outputMode?: OutputMode; - outputPath: OutputPathUnion; + outputPath?: OutputPathUnion; poll?: number; polyfills?: string[]; prerender?: PrerenderUnion; diff --git a/packages/angular/build/src/builders/application/options.ts b/packages/angular/build/src/builders/application/options.ts index a58c60386c9c..2fd1a2f5430c 100644 --- a/packages/angular/build/src/builders/application/options.ts +++ b/packages/angular/build/src/builders/application/options.ts @@ -295,7 +295,7 @@ export async function normalizeOptions( }; } - const outputPath = options.outputPath; + const outputPath = options.outputPath ?? path.join(workspaceRoot, 'dist', projectName); const outputOptions: NormalizedOutputOptions = { browser: 'browser', server: 'server', diff --git a/packages/angular/build/src/builders/application/schema.json b/packages/angular/build/src/builders/application/schema.json index d990e3a3cff3..fabb4dcddfcc 100644 --- a/packages/angular/build/src/builders/application/schema.json +++ b/packages/angular/build/src/builders/application/schema.json @@ -605,7 +605,7 @@ } }, "additionalProperties": false, - "required": ["outputPath", "index", "browser", "tsConfig"], + "required": ["index", "browser", "tsConfig"], "definitions": { "assetPattern": { "oneOf": [