Skip to content

The @nx/rspack plugin provides various executors to help you create and configure rspack projects within your Nx workspace. Below is a complete reference for all available executors and their options.

dev-server

Run @rspack/dev-server to serve a project.

Options

OptionTypeDescriptionDefault
buildTargetstring [required]The build target for rspack.
hoststringHost to listen on."localhost"
modestringMode to run the server in.
portnumberThe port to for the dev-server to listen on.
proxyConfigstringPath to proxy configuration file. For more information, see https://rspack.rs/config/dev-server#devserverproxy.
publicHoststringPublic URL where the application will be served.
sslbooleanServe using HTTPS.false
sslCertstringSSL certificate to use for serving HTTPS.
sslKeystringSSL key to use for serving HTTPS.

module-federation-dev-server

Serve a module federation application.

Options

OptionTypeDescriptionDefault
buildTargetstringTarget which builds the application.
devRemotesarrayList of Producer (remote) applications to run in development mode (i.e. using serve target).
hoststringHost to listen on."localhost"
isInitialHostbooleanWhether the Consumer (host) that is running this executor is the first in the project tree to do so.true
parallelnumberMax number of parallel processes for building static Producers (remotes).
pathToManifestFilestringPath to a Module Federation manifest file (e.g. my/path/to/module-federation.manifest.json) containing the dynamic Producer (remote) applications relative to the workspace root.
portnumberPort to listen on.4200
publicHoststringPublic URL where the application will be served.
skipRemotesarrayList of Producer (remote) applications to not automatically serve, either statically or in development mode. This will not remove the Producers (remotes) from the module-federation.config file, and therefore the application may still try to fetch these Producers (remotes).
This option is useful if you have other means for serving the Producer (remote) application(s).
NOTE: Producers (remotes) that are not in the workspace will be skipped automatically.
sslbooleanServe using HTTPS.false
sslCertstringSSL certificate to use for serving HTTPS.
sslKeystringSSL key to use for serving HTTPS.
staticbooleanWhether to use a static file server instead of the rspack-dev-server. This should be used for Producer (remote) applications that are also Consumer (host) applications.
staticRemotesPortnumberThe port at which to serve the file-server for the static Producers (remotes).

module-federation-ssr-dev-server

Serve a SSR Consumer (host) application along with its known Producers (remotes).

Options

OptionTypeDescriptionDefault
browserTargetstring [required]Target which builds the browser application.
serverTargetstring [required]Target which builds the server application.
devRemotesarrayList of Producers (remote) applications to run in development mode (i.e. using serve target).
hoststringHost to listen on."localhost"
isInitialHostbooleanWhether the Consumer (host) that is running this executor is the first in the project tree to do so.true
pathToManifestFilestringPath to a Module Federation manifest file (e.g. my/path/to/module-federation.manifest.json) containing the dynamic Producers (remote) applications relative to the workspace root.
portnumberThe port to be set on process.env.PORT for use in the server.4200
publicHoststringPublic URL where the application will be served.
skipRemotesarrayList of Producers (remote) applications to not automatically serve, either statically or in development mode.
sslbooleanServe using HTTPS.false
sslCertstringSSL certificate to use for serving HTTPS.
sslKeystringSSL key to use for serving HTTPS.
staticRemotesPortnumberThe port at which to serve the file-server for the static Producers (remotes).

module-federation-static-server

Serve a Consumer (host) application statically along with it’s Producers (remotes).

Options

OptionTypeDescriptionDefault
serveTargetstring [required]

rspack

Run Rspack via an executor for a project.

Options

OptionTypeDescriptionDefault
rspackConfigstring [required]The path to the rspack config file.
additionalEntryPointsarray
assetsarrayList of static application assets.[]
baseHrefstringBase url for the application being built.
buildLibsFromSourcebooleanRead buildable libraries from source instead of building them separately. If set to false, the tsConfig option must also be set to remap paths.true
deployUrlstringURL where the application will be deployed.
externalDependenciesstringDependencies to keep external to the bundle. (all (default), none, or an array of module names)
extractCssbooleanExtract CSS into a .css file.
extractLicensesbooleanExtract all licenses in a separate file.false
fileReplacementsarrayReplace files with other files in the build.[]
generateIndexHtmlbooleanGenerates 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.
generatePackageJsonbooleanGenerates a package.json and pruned lock file with the project’s node_module dependencies populated for installing in a container. If a package.json exists in the project’s directory, it will be reused with dependencies populated.
indexstringHTML File which will be contain the application.
mainstringThe main entry file.
memoryLimitnumberMemory limit for type checking service process in MB.
modestringMode to run the build in.
namedChunksbooleanNames the produced bundles according to their entry file.
optimizationstringEnables optimization of the build output.
outputFileNamestringThe main output entry file
outputHashingstringDefine the output filename cache-busting hashing mode.
outputPathstringThe output path for the bundle.
pollnumberEnable and define the file watching poll time period.
polyfillsstringPolyfills to load before application
postcssConfigstringSet 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.
progressbooleanLog progress to the console while building.
publicPathstringSet a public path for assets resources with absolute paths.
rebaseRootRelativebooleanWhether to rebase absolute path for assets in postcss cli resources.
runtimeChunkbooleanUse a separate bundle containing the runtime.
sassImplementationstringThe implementation of the SASS compiler to use. Can be either sass or sass-embedded. Defaults to sass-embedded."sass"
scriptsarrayExternal Scripts which will be included before the main application entry.
skipTypeCheckingbooleanSkip the type checking. Default is false.
sourceMapstringOutput sourcemaps. Use ‘hidden’ for use with error reporting tools without generating sourcemap comment.true
standardRspackConfigFunctionbooleanSet to true if the rspack config exports a standard rspack function, not an Nx-specific one. See: https://rspack.dev/config/false
statsJsonbooleanGenerates a ‘stats.json’ file which can be analyzed using tools such as: ‘webpack-bundle-analyzer’ See: https://rspack.dev/guide/optimization/analysis
stylePreprocessorOptionsobjectOptions to pass to style preprocessors.
stylesarrayExternal Styles which will be included with the application
targetstringThe platform to target (e.g. web, node).
transformersarrayList of TypeScript Compiler Transfomers Plugins.
tsConfigstringThe tsconfig file to build the project.
vendorChunkbooleanUse a separate bundle containing only vendor libraries.

ssr-dev-server

Serve a SSR application using rspack.

Options

OptionTypeDescriptionDefault
browserTargetstring [required]Target which builds the browser application.
serverTargetstring [required]Target which builds the server application.
browserTargetOptionsobjectAdditional options to pass into the browser build target.{}
portnumberThe port to be set on process.env.PORT for use in the server.4200
serverTargetOptionsobjectAdditional options to pass into the server build target.{}