@nx/rollup - Migrations
The @nx/rollup plugin provides various migrations to help you migrate to newer versions of rollup 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-remove-use-legacy-typescript-plugin
Section titled “update-23-0-0-remove-use-legacy-typescript-plugin”Version: 23.0.0-beta.4
Remove deprecated useLegacyTypescriptPlugin option from @nx/rollup:rollup
Remove the useLegacyTypescriptPlugin Option from the @nx/rollup:rollup Executor
Section titled “Remove the useLegacyTypescriptPlugin Option from the @nx/rollup:rollup Executor”Removes the deprecated useLegacyTypescriptPlugin option from the @nx/rollup:rollup executor. The legacy TypeScript plugin support has been dropped; the option no longer has any effect. The migration removes it from project configuration, target defaults in nx.json, and rollup.config.* files that pass it to withNx.
Sample Code Changes
Section titled “Sample Code Changes”Remove useLegacyTypescriptPlugin from the @nx/rollup:rollup executor options in project configuration.
Before
Section titled “Before”{ "targets": { "build": { "executor": "@nx/rollup:rollup", "options": { "main": "libs/my-lib/src/index.ts", "outputPath": "dist/libs/my-lib", "useLegacyTypescriptPlugin": true } } }}{ "targets": { "build": { "executor": "@nx/rollup:rollup", "options": { "main": "libs/my-lib/src/index.ts", "outputPath": "dist/libs/my-lib" } } }}Remove useLegacyTypescriptPlugin from the @nx/rollup:rollup executor target defaults in nx.json.
Before
Section titled “Before”{ "targetDefaults": { "@nx/rollup:rollup": { "options": { "outputPath": "dist/{projectRoot}", "tsConfig": "{projectRoot}/tsconfig.lib.json", "useLegacyTypescriptPlugin": true } } }}{ "targetDefaults": { "@nx/rollup:rollup": { "options": { "outputPath": "dist/{projectRoot}", "tsConfig": "{projectRoot}/tsconfig.lib.json" } } }}Remove useLegacyTypescriptPlugin from withNx calls in rollup.config.* files.
Before
Section titled “Before”const { withNx } = require('@nx/rollup/with-nx');module.exports = withNx({ outputPath: '../../dist/libs/my-lib', main: './src/index.ts', tsConfig: './tsconfig.lib.json', format: ['cjs', 'esm'], useLegacyTypescriptPlugin: true,});const { withNx } = require('@nx/rollup/with-nx');module.exports = withNx({ outputPath: '../../dist/libs/my-lib', main: './src/index.ts', tsConfig: './tsconfig.lib.json', format: ['cjs', 'esm'],});rewrite-rollup-internal-subpath-imports
Section titled “rewrite-rollup-internal-subpath-imports”Version: 23.0.0-beta.24
Rewrites @nx/rollup/src/* subpath imports now that the ./src/* subpath is no longer exposed by @nx/rollup’s exports map. Named imports/exports of public symbols are routed to @nx/rollup and the rest to the new @nx/rollup/internal entry; require, dynamic import and jest.mock calls reference the whole module and are routed to @nx/rollup/internal.
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/rollup/plugin to the canonical createNodes export.
Rename createNodesV2 imports to createNodes
Section titled “Rename createNodesV2 imports to createNodes”@nx/rollup 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/rollup/plugin to createNodes.
Sample Code Changes
Section titled “Sample Code Changes”Before
Section titled “Before”import { createNodesV2 } from '@nx/rollup/plugin';import { createNodes } from '@nx/rollup/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/rollup/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.
23.0.0-package-updates
Section titled “23.0.0-package-updates”Version: 23.0.0-beta.24
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
rollup | ^4.14.0 | Added if not installed |