@nx/rollup - Migrations
For an overview of the plugin and setup instructions, see the @nx/rollup introduction.
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.
24.0.x
Section titled “24.0.x”remove-deprecated-executors
Section titled “remove-deprecated-executors”Version: 24.0.0-beta.3
Converts targets using the removed @nx/rollup executors to inferred tasks; an AI prompt finishes the targets the converter cannot convert safely and validates the project graph.
Convert @nx/rollup:rollup targets to inferred tasks
Section titled “Convert @nx/rollup:rollup targets to inferred tasks”Nx 24 removes the @nx/rollup:rollup executor and its @nrwl/rollup:rollup alias. The migration registers @nx/rollup/plugin in nx.json and converts the targets that use those executors to inferred tasks. It writes the executor options into a Rollup config file in the project root. A target with nothing left to override is removed from project configuration. When several projects share the same remaining options, those options move to a targetDefaults entry scoped to the plugin. targetDefaults entries keyed by a removed executor are removed once no target uses that executor.
The migration lists the targets the converter cannot convert safely. In agentic runs, an AI prompt finishes them and validates the project graph.
Sample code changes
Section titled “Sample code changes”Before
Section titled “Before”{ "name": "mypkg", "targets": { "build": { "executor": "@nx/rollup:rollup", "outputs": ["{options.outputPath}"], "options": { "main": "mypkg/src/index.ts", "outputPath": "dist/mypkg", "tsConfig": "mypkg/tsconfig.lib.json", "compiler": "babel", "format": ["esm"], "external": [], "assets": [] } } }}{ "plugins": [ { "plugin": "@nx/rollup/plugin", "options": { "buildTargetName": "build" } } ]}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 |