Skip to content

Rspack

The Rspack plugin gives every package with an Rspack config a build task, and a dev task when the config has a dev server.

Terminal window
axle add rspack

This writes it into the root axle.toml:

[plugins.rspack]
source = "npm:@axle-rs/[email protected]"
hash = "sha256-…"

A package or project with an rspack.config file, .ts, .mts, .cts, .js, .mjs or .cjs, in its folder gets:

Task Command Settings
build rspack build outputs the output folder
dev rspack serve when the config has a devServer; persistent

Each command runs through the repository’s package manager, such as pnpm exec rspack build, so it uses the version the package installs.

The output folder is output.path in the config, read without running it, and dist by default. When it is set to something other than a plain string, such as path.resolve(__dirname, 'out'), the plugin leaves outputs out and Axle finds the outputs the build writes itself.

A package’s own script wins. When its package.json has a script with a task’s name that runs something else, such as "build": "rspack build --mode production", the plugin leaves that task alone and Axle runs the script. A script that only runs Rspack the way the plugin would, rspack build, rspack, rspack serve or rspack dev, is replaced by the plugin’s task, which runs the same command and adds its settings. The repository’s axle.toml changes a task as it would any other, and wins over the plugin.

Setting Default Meaning
build "build" the name of the build task, or false to leave it out
dev "dev" the name of the dev server task, or false
[plugins.rspack]
source = "npm:@axle-rs/[email protected]"
hash = "sha256-…"
dev = false

The plugin’s answers are kept until an rspack.config.*, a package.json, pnpm-workspace.yaml or a lockfile changes.