Skip to content

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

application

React + Rspack application generator.

Usage:

Terminal window
nx generate @nx/rspack:application [options]

Aliases: app

Arguments:

Terminal window
nx generate @nx/rspack:application <directory> [options]

Options

OptionTypeDescriptionDefault
e2eTestRunnerstringThe e2e test runner to use."cypress"
frameworkstringThe framework to use for the application."react"
monorepobooleanCreates an integrated monorepo.
namestringThe name of the application.
rootProjectboolean
stylestringThe file extension to be used for style files."css"
tagsstringAdd tags to the application (used for linting).
unitTestRunnerstringThe unit test runner to use."jest"

configuration

Rspack configuration generator.

Usage:

Terminal window
nx generate @nx/rspack:configuration [options]

Arguments:

Terminal window
nx generate @nx/rspack:configuration <project> [options]

Options

OptionTypeDescriptionDefault
buildTargetstringThe build target of the project to be transformed to use the @nx/vite:build executor.
devServerbooleanAdd a serve target to run a local rspack dev-serverfalse
frameworkstringThe framework used by the project.
mainstringPath relative to the workspace root for the main entry file. Defaults to ‘/src/main.ts’.
newProjectbooleanIs this a new project?false
rootProjectboolean
serveTargetstringThe serve target of the project to be transformed to use the @nx/vite:dev-server and @nx/vite:preview-server executors.
stylestringThe style solution to use.
targetstringTarget platform for the build, same as the rspack config option."web"
tsConfigstringPath relative to the workspace root for the tsconfig file to build with. Defaults to ‘/tsconfig.app.json’.

convert-config-to-rspack-plugin

Convert existing Rspack project(s) using @nx/rspack:rspack executor that uses withNx to use NxAppRspackPlugin. Defaults to migrating all projects. Pass ‘—project’ to migrate only one target.

Usage:

Terminal window
nx generate @nx/rspack:convert-config-to-rspack-plugin [options]

Options

OptionTypeDescriptionDefault
projectstringThe project to convert from using the @nx/rspack:rspack executor and withNx plugin to use NxAppRspackPlugin.
skipFormatbooleanWhether to format files at the end of the migration.false

convert-to-inferred

Convert existing Rspack project(s) using @nx/rspack:rspack executor to use @nx/rspack/plugin.

Usage:

Terminal window
nx generate @nx/rspack:convert-to-inferred [options]

Options

OptionTypeDescriptionDefault
projectstringThe project to convert from using the @nx/rspack:rspack executor to use @nx/rspack/plugin. If not provided, all projects using the @nx/rspack:rspack executor will be converted.
skipFormatbooleanWhether to format files.false

convert-webpack

Convert a Webpack project to Rspack.

Usage:

Terminal window
nx generate @nx/rspack:convert-webpack [options]

Aliases: convert-to-rspack

Arguments:

Terminal window
nx generate @nx/rspack:convert-webpack <project> [options]

Options

OptionTypeDescriptionDefault
skipFormatbooleanSkip formatting files.false
## Getting Help
You can get help for any generator by adding the `--help` flag:
```bash
nx generate @nx/rspack:<generator> --help
```