build
ng buildng bThe command can be used to build a project of type "application" or "library".
When used to build a library, a different builder is invoked, and only the ts-config, configuration, poll and watch options are applied.
All other options apply only to building applications.
The application builder uses the esbuild build tool, with default configuration options specified in the workspace configuration file (angular.json) or with a named alternative configuration.
A "development" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the --configuration development.
The configuration options generally correspond to the command options. You can override individual configuration defaults by specifying the corresponding options on the command line. The command can accept option names given in dash-case. Note that in the configuration file, you must specify names in camelCase.
Some additional options can only be set through the configuration file,
either by direct editing or with the ng config command.
These include assets, styles, and scripts objects that provide runtime-global resources to include in the project.
Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
For further details, see Workspace Configuration.
Arguments
projectThe name of the project to build. Can be an application or a library.
stringOptions
allowed-common-js-dependenciesA list of CommonJS or AMD packages that are allowed to be used without a build time warning. Use '*' to allow all.
arrayaotBuild using Ahead of Time compilation.
booleanDefaulttrueapp-shellGenerates an application shell during build time.
booleanbase-hrefBase url for the application being built.
stringbrowserThe full path for the browser entry point to the application, relative to the current workspace.
stringclear-screenAutomatically clear the terminal screen during rebuilds.
booleanDefaultfalseconditionsCustom package resolution conditions used to resolve conditional exports/imports. Defaults to ['module', 'development'/'production']. The following special conditions are always present if the requirements are satisfied: 'default', 'import', 'require', 'browser', 'node'.
arrayconfigurationcOne or more named builder configurations as a comma-separated list as specified in the "configurations" section in angular.json. The builder uses the named configurations to run the given target. For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.
stringcross-originDefine the crossorigin attribute setting of elements that provide CORS support.
stringAllowed Valuesanonymous, none, use-credentialsDefaultnonedefineDefines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.
arraydelete-output-pathDelete the output path before building.
booleanDefaulttruedeploy-urlCustomize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations.
stringexternal-dependenciesExclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime. Note: @foo/bar marks all paths within the @foo/bar package as external, including sub-paths like @foo/bar/baz.
arrayextract-licensesExtract all licenses in a separate file.
booleanDefaulttruehelpShows a help message for this command in the console.
booleani18n-duplicate-translationHow to handle duplicate translations for i18n.
stringAllowed Valueserror, ignore, warningDefaultwarningi18n-missing-translationHow to handle missing translations for i18n.
stringAllowed Valueserror, ignore, warningDefaultwarningindexConfigures the generation of the application's HTML index.
stringinline-style-languageThe stylesheet language to use for the application's inline component styles.
stringAllowed Valuescss, less, sass, scssDefaultcsslocalizeTranslate the bundles in one or more locales.
booleannamed-chunksUse file name for lazy loaded chunks.
booleanDefaultfalseoptimizationEnables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.dev/reference/configs/workspace-config#optimization-configuration.
booleanDefaulttrueoutput-hashingDefine the output filename cache-busting hashing mode.
stringAllowed Valuesall, bundles, media, noneDefaultnoneoutput-modeDefines the build output target. 'static': Generates a static site for deployment on any static hosting service. 'server': Produces an application designed for deployment on a server that supports server-side rendering (SSR).
stringAllowed Valuesserver, staticoutput-pathSpecify the output path relative to workspace root.
stringpollEnable and define the file watching poll time period in milliseconds.
numberpolyfillsA list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.
arrayprerenderPrerender (SSG) pages of your application during build time.
booleanpreserve-symlinksDo not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set.
booleanprogressLog progress to the console while building.
booleanDefaulttrueserverThe full path for the server entry point to the application, relative to the current workspace.
stringservice-workerGenerates a service worker configuration.
stringsource-mapOutput source maps for scripts and styles. For more information, see https://angular.dev/reference/configs/workspace-config#source-map-configuration.
booleanDefaultfalsessrServer side render (SSR) pages of your application during runtime.
booleanDefaultfalsestats-jsonGenerates a 'stats.json' file which can be analyzed with https://esbuild.github.io/analyze/.
booleanDefaultfalsesubresource-integrityEnables the use of subresource integrity validation.
booleanDefaultfalsets-configThe full path for the TypeScript configuration file, relative to the current workspace.
stringverboseAdds more details to output logging.
booleanDefaultfalsewatchRun build when files change.
booleanDefaultfalseweb-worker-ts-configTypeScript configuration for Web Worker modules.
string