Compiles an application into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
build command is a built-in alias to the run command.
These two commands are equivalent:
nx build <project> [options]
nx run <project>:build [options]
nx package globally to invoke the command directly using
nx, or use
npm run nx or
production build of the
nx build myapp --prod
The options below are common to the
build command used within an Nx workspace. The Web and Angular-specifc build options are listed after these options.
Base url for the application being built.
Use a separate bundle containing code used across multiple bundles.
Budget thresholds to ensure parts of your application stay within boundaries which you set.
Names the produced bundles according to their entry file
URL where the application will be deployed.
Conditional polyfills loaded in browsers which do not support ES2015.
Extract css into a .css file
Extract all licenses in a separate file, in the case of production builds only.
HTML File which will be contain the application
The name of the main entry-point file.
The name of the Typescript configuration file.
The output path of the generated files.
Log progress to the console while building.
Enables optimization of the build output.
Define the output filename cache-busting hashing mode.
External Scripts which will be included before the main application entry.
Show circular dependency warnings on builds.
Generates a 'stats.json' file which can be analyzed using tools such as: #webpack-bundle-analyzer' or https://webpack.github.io/ analyse.
External Styles which will be included with the application
Enables the use of subresource integrity validation.
Use a separate bundle containing only vendor libraries.
Emits verbose output
Enable re-building when files change.
Show help information
Show version number
List of static application assets.
Replace files with other files in the build.
Number of workers to use for type checking.
# of CPUS - 2
Memory limit for type checking service process in MB.
Polyfills to load before application
Options to pass to style preprocessors.
Path to a function which takes a webpack config, some context and returns the resulting webpack config
Build using Ahead of Time compilation.
EXPERIMENTAL Output file path for Build Event Protocol events
@angular-devkit/build-optimizer optimizations when using the
A named build target, as specified in the "configurations" section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. Setting this explicitly overrides the "--prod" flag
Define the crossorigin attribute setting of elements that provide CORS support.
Delete the output path before building.
URL where files will be deployed.
Enables conditionally loaded ES2015 polyfills.
Output in-file eval sourcemaps.
Concatenate modules with Rollup before bundling them with Webpack.
Run the TypeScript type checker in a forked process.
Localization file to use for i18n.
Format of the localization file specified with --i18n-file.
Locale to use for i18n.
How to handle missing translations for i18n.
Path to ngsw-config.json.
Enable and define the file watching poll time period in milliseconds.
The full path for the polyfills file, relative to the current workspace.
Do not use the real path when resolving modules.
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.
The path where style resources will be placed, relative to outputPath.
Generates a service worker config for production builds.
Flag to prevent building an app shell.
Resolve vendor packages sourcemaps.
Adds more details to output logging.
TypeScript configuration for Web Worker modules.