@nx/angular:application

Builds an application with esbuild with support for incremental builds. Note: this is only supported in Angular versions >= 17.0.0.

Options can be configured in project.json when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.

The @nx/angular:application executor is very similar to the @angular-devkit/build-angular:application builder provided by the Angular CLI. It builds an Angular application using esbuild with integrated SSR and prerendering capabilities.

In addition to the features provided by the Angular CLI builder, the @nx/angular:application executor also supports the following:

  • Providing esbuild plugins
  • Incremental builds

Examples

The executor accepts a plugins option that allows you to provide esbuild plugins that will be used when building your application. It allows providing a path to a plugin file or an object with a path and options property to provide options to the plugin.

1"build": { 2 "executor": "@nx/angular:application", 3 "options": { 4 ... 5 "plugins": [ 6 "apps/my-app/plugins/plugin1.js", 7 { 8 "path": "apps/my-app/plugins/plugin2.js", 9 "options": { 10 "someOption": "someValue" 11 } 12 } 13 ] 14 } 15} 16
Nx 15 and lower use @nrwl/ instead of @nx/

Options

browser

Required
string

The full path for the browser entry point to the application, relative to the current workspace.

index

Required
oneOf [string, object , boolean]

Configures the generation of the application's HTML index.

outputPath

Required
string

The full path for the new output directory, relative to the current workspace.

tsConfig

Required
string

The full path for the TypeScript configuration file, relative to the current workspace.

assets

Array<oneOf [object , string]>
Default: []

List of static application assets.

aot

boolean
Default: true

Build using Ahead of Time compilation.

allowedCommonJsDependencies

Array<string>
Default: []

A list of CommonJS or AMD packages that are allowed to be used without a build time warning. Use '*' to allow all.

appShell

boolean
Default: false

Generates an application shell during build time.

baseHref

string

Base url for the application being built.

budgets

Default: []

Budget thresholds to ensure parts of your application stay within boundaries which you set.

buildLibsFromSource

boolean
Default: true

Read buildable libraries from source instead of building them separately.

crossOrigin

string
Default: none
Accepted values: none, anonymous, use-credentials

Define the crossorigin attribute setting of elements that provide CORS support.

deleteOutputPath

boolean
Default: true

Delete the output path before building.

externalDependencies

Array<string>
Default: []

Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.

extractLicenses

boolean
Default: true

Extract all licenses in a separate file.

fileReplacements

Default: []

Replace compilation source files with other compilation source files in the build.

inlineStyleLanguage

string
Default: css
Accepted values: css, less, sass, scss

The stylesheet language to use for the application's inline component styles.

i18nMissingTranslation

string
Default: warning
Accepted values: warning, error, ignore

How to handle missing translations for i18n.

i18nDuplicateTranslation

string
Default: warning
Accepted values: warning, error, ignore

How to handle duplicate translations for i18n.

localize

oneOf [boolean, Array<string>]

Translate the bundles in one or more locales.

namedChunks

boolean
Default: false

Use file name for lazy loaded chunks.

optimization

oneOf [object , boolean]
Default: true

Enables 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.io/guide/workspace-config#optimization-configuration.

outputHashing

string
Default: none
Accepted values: none, all, media, bundles

Define the output filename cache-busting hashing mode.

polyfills

Array<string>
Default: []

A 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'.

progress

boolean
Default: true

Log progress to the console while building.

poll

number

Enable and define the file watching poll time period in milliseconds.

boolean

Do not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set.

prerender

oneOf [boolean, object ]
Default: false

Prerender (SSG) pages of your application during build time.

plugins

Array<oneOf [object , string]>

A list of ESBuild plugins.

server

string

The full path for the server entry point to the application, relative to the current workspace.

scripts

Array<oneOf [object , string]>
Default: []

Global scripts to be included in the build.

styles

Array<oneOf [object , string]>
Default: []

Global styles to be included in the build.

stylePreprocessorOptions

Options to pass to style preprocessors.

sourceMap

oneOf [object , boolean]
Default: false

Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.

subresourceIntegrity

boolean
Default: false

Enables the use of subresource integrity validation.

serviceWorker

oneOf [string, boolean]
Default: false

Generates a service worker configuration.

statsJson

boolean
Default: false

Generates a 'stats.json' file which can be analyzed with https://esbuild.github.io/analyze/.

ssr

oneOf [boolean, object ]
Default: false

Server side render (SSR) pages of your application during runtime.

verbose

boolean
Default: false

Adds more details to output logging.

watch

boolean
Default: false

Run build when files change.

webWorkerTsConfig

string

TypeScript configuration for Web Worker modules.