Browser builder

This is the documentation for Angular 7.
You can switch to the latest version Angular 9.

ID: @angular-devkit/build-angular:browser

Options

--aot#

Build using Ahead of Time compilation.

Type boolean

--assets#

List of static application assets.

Type array

--baseHref#

Base URL for the application being built.

--budgets#

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

Type array

--buildEventLog#

Output file path for Build Event Protocol events.

Type string

--buildOptimizer#

Enables @angular-devkit/build-optimizer optimizations when using the 'aot' option.

Type boolean

--commonChunk#

Use a separate bundle containing code used across multiple bundles.

Type boolean
Default true

--deleteOutputPath#

Delete the output path before building.

Type boolean
Default true

--deployUrl#

URL where files will be deployed.

Type string

--es5BrowserSupport#

Enables conditionally loaded ES2015 polyfills.

Type boolean
Default false
Links & Tutorials

--evalSourceMap#

Output in-file eval sourcemaps.

Type boolean

--extractCss#

Extract css from global styles onto css files instead of js ones.

Type boolean
Default false

--extractLicenses#

Extract all licenses in a separate file, in the case of production builds only.

Type boolean
Default true

--fileReplacements#

Replace files with other files in the build.

Type array
Links & Tutorials

--forkTypeChecker#

Run the TypeScript type checker in a forked process.

Type boolean
Default true

--i18nFile#

Localization file to use for i18n.

Type string

--i18nFormat#

Format of the localization file specified with i18nFile.

Type string

--i18nLocale#

Locale to use for i18n.

Type string

--i18nMissingTranslation#

How to handle missing translations for i18n.

Type string

--index#

The name of the index HTML file.

Type string

--lazyModules#

List of additional NgModule files that will be lazy loaded. Lazy router modules with be discovered automatically.

Type array

--main#

The name of the main entry-point file.

Type string

--namedChunks#

Use file name for lazy loaded chunks.

Type boolean
Default true

--ngswConfigPath#

Path to ngsw-config.json.

Type string

--optimization#

Defines the optimization level of the build.

It also can take a more fine-grained value, as you can now give an object to configure if you want optimize only the scripts or styles.

"optimization": {
  "scripts": true,
  "styles": true
}
Type boolean | Object
Default false

--outputHashing#

Define the output filename cache-busting hashing mode.

Type string
Values none,all,media,bundles
Default none

--outputPath#

Path where output will be placed.

Type string

--poll#

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

Type number

--polyfills#

The name of the polyfills file.

Type string

Do not use the real path when resolving modules.

Type boolean

--progress#

Log progress to the console while building.

Type boolean
Default true

--rebaseRootRelativeCssUrls#

Change root relative URLs in stylesheets to include base HREF and deploy URL. Use only for compatibility and transition. The behavior of this option is non-standard and will be removed in the next major release.

Type boolean

--resourcesOutputPath#

Specify where resources will be placed, relative to outputPath.

Type string
Hint

You can ouput your CSS in other folder.

--scripts#

Global scripts to be included in the build.

Type array

--serviceWorker#

Generates a service worker config for production builds.

Type boolean

--showCircularDependencies#

Show circular dependency warnings on builds.

Type boolean
Default true

--skipAppShell#

Flag to prevent building an app shell.

Type boolean

--sourceMap#

Output sourcemaps.

It also can take a more fine-grained value, as you can now give an object to configure if you want only the scripts source maps, the styles source maps, the vendor source maps, or the hidden source maps.

"sourceMap": {
  "scripts": true,
  "styles": true,
  "hidden": true,
  "vendor": true
}
Type boolean | Object
Default true

--statsJson#

Generates a 'stats.json' file which can be analyzed using tools such as: #webpack-bundle-analyzer or https://webpack.github.io/analyse.

Type boolean
Hint

View generated stats:

  • npm install -g webpack-bundle-analyzer
  • webpack-bundle-analyzer dist/stats.json
Links & Tutorials

--stylePreprocessorOptions#

Options to pass to style preprocessors.

Type object
Links & Tutorials

--styles#

Global styles to be included in the build.

Type array

--subresourceIntegrity#

Enables the use of subresource integrity validation.

Type boolean

--tsConfig#

The name of the TypeScript configuration file.

Type string

--vendorChunk#

Use a separate bundle containing only vendor libraries.

Type boolean
Default true

--vendorSourceMap#

Resolve vendor packages sourcemaps.

Type boolean
Default false

--verbose#

Adds more details to output logging.

Type boolean

--watch#

Run build when files change.

Type boolean

--webWorkerTsConfig#

TypeScript configuration for Web Worker modules.

Type string