@nrwl/web:webpack

Builds web applications using webpack

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/configuration/projectjson#targets.

Options

assets

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

List of static application assets.

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

The crossorigin attribute to use for generated javascript script tags. One of 'none' | 'anonymous' | 'use-credentials'.

compiler

string
Default: babel
Accepted values: babel, swc

The compiler to use.

commonChunk

boolean
Default: true

Use a separate bundle containing code used across multiple bundles.

deleteOutputPath

boolean
Default: true

Delete the output path before building.

deployUrl

string

URL where the application will be deployed.

extractCss

boolean
Default: false

Extract CSS into a .css file.

es2015Polyfills

string

Conditional polyfills loaded in browsers which do not support ES2015.

extractLicenses

boolean
Default: false

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

fileReplacements

Default: []

Replace files with other files in the build.

generateIndexHtml

boolean
Default: true

Generates index.html file to the output path. This can be turned off if using a webpack plugin to generate HTML such as html-webpack-plugin.

index

Required
string

HTML File which will be contain the application.

main

Required
string

The name of the main entry-point file.

memoryLimit

number
Default: 2048

Memory limit for type checking service process in MB.

maxWorkers

number
Default: 2

Number of workers to use for type checking.

namedChunks

boolean
Default: true

Names the produced bundles according to their entry file.

outputPath

string

The output path of the generated files.

outputHashing

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

Define the output filename cache-busting hashing mode.

optimization

oneOf [object , boolean]

Enables optimization of the build output.

progress

boolean
Default: false

Log progress to the console while building.

polyfills

string

Polyfills to load before application

postcssConfig

string

Set a path to PostCSS config that applies to the app and all libs. Defaults to undefined, which auto-detects postcss.config.js files in each app/lib directory.

runtimeChunk

boolean
Default: true

Use a separate bundle containing the runtime.

sourceMap

oneOf [boolean, string]
Default: true

Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.

scripts

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

External Scripts which will be included before the main application entry.

styles

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

External Styles which will be included with the application

stylePreprocessorOptions

Options to pass to style preprocessors.

subresourceIntegrity

boolean
Default: false

Enables the use of subresource integrity validation.

statsJson

boolean
Default: false

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

tsConfig

Required
string

The name of the Typescript configuration file.

vendorChunk

boolean
Default: true

Use a separate bundle containing only vendor libraries.

verbose

boolean
Default: false

Emits verbose output

watch

boolean
Default: false

Enable re-building when files change.

webpackConfig

string

Path to a function which takes a webpack config, some context and returns the resulting webpack config. See https://nx.dev/guides/customize-webpack