@nx/rspack - Migrations
The @nx/rspack plugin provides various migrations to help you migrate to newer versions of rspack projects within your Nx workspace. Below is a complete reference for all available migrations.
23.0.x
Section titled “23.0.x”update-23-0-0-add-svgr-to-rspack-config
Section titled “update-23-0-0-add-svgr-to-rspack-config”Version: 23.0.0-beta.9
Updates rspack configs using React to use the new withSvgr composable function instead of the svgr option in withReact or NxReactRspackPlugin.
Replace the svgr Option with the withSvgr Composable in Rspack Configs
Section titled “Replace the svgr Option with the withSvgr Composable in Rspack Configs”Updates rspack configs that use React to use a new withSvgr composable function instead of passing an svgr option to withReact or NxReactRspackPlugin. The option was removed; SVG handling is now consolidated into the images asset rule by default. The migration inlines a withSvgr helper into each affected config so existing SVGR-as-React-component behavior is preserved.
Sample Code Changes
Section titled “Sample Code Changes”Replace the svgr option on withReact with a withSvgr(...) call composed alongside it.
Before
Section titled “Before”const { composePlugins, withNx, withReact } = require('@nx/rspack');
module.exports = composePlugins( withNx(), withReact({ svgr: { svgo: false, titleProp: true, ref: true } }));const { composePlugins, withNx, withReact } = require('@nx/rspack');
// SVGR support function (migrated from svgr option in withReact/NxReactRspackPlugin)function withSvgr(svgrOptions = {}) { const defaultOptions = { svgo: false, titleProp: true, ref: true }; const options = { ...defaultOptions, ...svgrOptions }; return function configure(config) { const svgLoaderIdx = config.module.rules.findIndex( (rule) => typeof rule === 'object' && typeof rule.test !== 'undefined' && rule.test.toString().includes('svg') ); if (svgLoaderIdx !== -1) { config.module.rules.splice(svgLoaderIdx, 1); } config.module.rules.push( { test: /\.svg$/i, type: 'asset', resourceQuery: /url/ }, { test: /\.svg$/i, issuer: /\.[jt]sx?$/, resourceQuery: { not: [/url/] }, use: [{ loader: '@svgr/webpack', options }], } ); return config; };}
module.exports = composePlugins( withNx(), withReact(), withSvgr({ svgo: false, titleProp: true, ref: true }));For the NxReactRspackPlugin style, the svgr option is removed from the plugin call and the entire module.exports is wrapped with a withSvgr(...) call that registers the loader rules directly on the compiler.
Before
Section titled “Before”const { NxReactRspackPlugin } = require('@nx/rspack');
module.exports = { plugins: [new NxReactRspackPlugin({ svgr: true, main: './src/main.tsx' })],};const { NxReactRspackPlugin } = require('@nx/rspack');
// SVGR support function (migrated from svgr option in withReact/NxReactRspackPlugin)function withSvgr(svgrOptions = {}) { /* same helper as above, compiler.options.module.rules variant */}
module.exports = withSvgr()({ plugins: [new NxReactRspackPlugin({ main: './src/main.tsx' })],});update-23-0-0-migrate-create-nodes-v2-import
Section titled “update-23-0-0-migrate-create-nodes-v2-import”Version: 23.0.0-beta.24
Rename imports of createNodesV2 from @nx/rspack/plugin to the canonical createNodes export.
Rename createNodesV2 imports to createNodes
Section titled “Rename createNodesV2 imports to createNodes”@nx/rspack renamed its primary inferred-plugin export from createNodesV2 to createNodes. The createNodesV2 name is preserved as a deprecated alias for now, but new code should use createNodes.
This migration scans every .ts, .tsx, .cts, and .mts file in your workspace and rewrites named imports and re-exports of createNodesV2 from @nx/rspack/plugin to createNodes.
Sample Code Changes
Section titled “Sample Code Changes”Before
Section titled “Before”import { createNodesV2 } from '@nx/rspack/plugin';import { createNodes } from '@nx/rspack/plugin';Aliases are preserved (createNodesV2 as cn becomes createNodes as cn), and if a file already imports both names ({ createNodes, createNodesV2 }) the redundant binding is dropped.
What is not rewritten
Section titled “What is not rewritten”Only static import/export named bindings from @nx/rspack/plugin are rewritten. Namespace imports, dynamic import(...), require(...) destructuring, and property access such as plugin.createNodesV2 are left untouched — they keep working through the createNodesV2 runtime alias. Update those by hand if you want to drop the deprecated name everywhere.
22.2.x
Section titled “22.2.x”22.2.0-module-federation-enhanced-package-updates
Section titled “22.2.0-module-federation-enhanced-package-updates”Version: 22.2.0-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@module-federation/enhanced | ^0.21.2 | Updated only |
22.2.0-module-federation-sdk-package-updates
Section titled “22.2.0-module-federation-sdk-package-updates”Version: 22.2.0-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@module-federation/sdk | ^0.21.2 | Updated only |
22.2.0-module-federation-runtime-package-updates
Section titled “22.2.0-module-federation-runtime-package-updates”Version: 22.2.0-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@module-federation/runtime | ^0.21.2 | Updated only |
22.2.0-module-federation-node-package-updates
Section titled “22.2.0-module-federation-node-package-updates”Version: 22.2.0-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@module-federation/node | ^2.7.21 | Updated only |
22.0.x
Section titled “22.0.x”remove-deprecated-rspack-options
Section titled “remove-deprecated-rspack-options”Version: 22.0.0-beta.1
Remove deprecated deleteOutputPath and sassImplementation options from rspack configurations.
21.5.x
Section titled “21.5.x”21.5.0-package-updates
Section titled “21.5.0-package-updates”Version: 21.5.0-beta.2
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@rspack/core | ^1.5.0 | Updated only |
@rspack/dev-server | ^1.1.4 | Updated only |
21.4.x
Section titled “21.4.x”21.4.0-package-updates
Section titled “21.4.0-package-updates”Version: 21.4.0-beta.8
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
http-proxy-middleware | ^3.0.5 | Updated only |
21.3.x
Section titled “21.3.x”21.3.0-module-federation-enhanced-package-updates
Section titled “21.3.0-module-federation-enhanced-package-updates”Version: 21.3.0-beta.8
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@module-federation/enhanced | ^0.17.0 | Updated only |
21.3.0-module-federation-node-package-updates
Section titled “21.3.0-module-federation-node-package-updates”Version: 21.3.0-beta.8
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@module-federation/node | ^2.7.9 | Updated only |
21.0.x
Section titled “21.0.x”21.0.1-package-updates
Section titled “21.0.1-package-updates”Version: 21.0.1-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@rspack/core | ^1.3.8 | Updated only |
@rspack/dev-server | ^1.1.1 | Updated only |