Skip to content
AI Monorepos Free online conference · June 23 Join us!

@nx/vite - Migrations

The @nx/vite plugin provides various migrations to help you migrate to newer versions of vite projects within your Nx workspace. Below is a complete reference for all available migrations.

Version: 23.0.0-beta.10

Safety net: ensure any remaining @nx/vite:test executor usages are swapped to @nx/vitest:test and @nx/vitest is installed.

Migration that runs automatically when upgrading to Nx 23. It is a safety net for workspaces that still have @nx/vite vitest artifacts in place after the optional v22 migration.

  1. Installs @nx/vitest: added to devDependencies when vitest is detected in the workspace (skipped when already present or when the workspace does not use vitest at all).
  2. Swaps @nx/vite:test to @nx/vitest:test: updates every project.json target and every targetDefaults entry that still references the removed executor.
  3. Splits @nx/vite/plugin registrations: vitest-related options (testTargetName, ciTargetName, ciGroupName) are extracted from each @nx/vite/plugin entry and moved to a new @nx/vitest plugin entry. The vite entry is updated to retain only build/serve/preview options.
  4. Registers @nx/vitest plugin: for workspaces that used @nx/vite/plugin in its default configuration (no vitest options), a matching @nx/vitest plugin entry is added automatically so vitest targets continue to be inferred.

The vitest support that previously lived in @nx/vite (the @nx/vite:test executor, the @nx/vite:vitest generator, and the vitest target inference in @nx/vite/plugin) was removed in Nx 23 and is now exclusively provided by the @nx/vitest package. See the Migrating from @nx/vite guide.

Run nx migrate and this migration will handle the conversion automatically. To verify the result, check nx.json, your project.json files, and package.json after running migrations.

Version: 23.0.0-beta.10

Rename rollupOptions to rolldownOptions in vite config files (top-level and inside environments). Vite 8 replaced Rollup with Rolldown.

NameVersion
vite>=8.0.0

Rename rollupOptions to rolldownOptions in Vite Config Files

Section titled “Rename rollupOptions to rolldownOptions in Vite Config Files”

Renames the rollupOptions property to rolldownOptions inside vite.config.{js,ts,mjs,mts,cjs,cts} files. Vite 8 replaced Rollup with Rolldown as its production bundler; rollupOptions is accepted as a deprecated alias but logs a warning and may produce precedence surprises when both keys are present. The migration covers top-level usage as well as nested environments.<env>.build.rollupOptions.

The migration only touches files matching vite.*config*.{js,ts,mjs,mts,cjs,cts}. Helper modules imported by your config and rollupOptions declared elsewhere need to be renamed by hand.

Top-level rename inside build.

apps/myapp/vite.config.ts
export default defineConfig({
build: {
rollupOptions: {
external: ['react'],
},
},
});
apps/myapp/vite.config.ts
export default defineConfig({
build: {
rolldownOptions: {
external: ['react'],
},
},
});

The same rename applies inside environments.<env>.build.

apps/myapp/vite.config.ts
export default defineConfig({
environments: {
ssr: {
build: {
rollupOptions: { external: ['fs'] },
},
},
},
});
apps/myapp/vite.config.ts
export default defineConfig({
environments: {
ssr: {
build: {
rolldownOptions: { external: ['fs'] },
},
},
},
});

Note: Rolldown is largely Rollup-compatible but a handful of options have different semantics. The most common one to check after this migration: output.manualChunks only accepts a function in Rolldown (the object-of-globs form is invalid). See tools/ai-migrations/MIGRATE_VITE_8.md (created by a sibling migration) for the full Vite 8 upgrade checklist.

Version: 23.0.0-beta.10

Create AI Instructions to help migrate users workspaces past breaking changes for Vite 8.

NameVersion
vite>=8.0.0

Version: 23.0.0-beta.22

Migrate workspaces past breaking changes for Vitest 3.

NameVersion
vitest>=3.0.0

Version: 23.0.0-beta.22

Migrate workspaces past breaking changes for Vitest 4.

NameVersion
vitest>=4.0.0

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/vite/plugin to the canonical createNodes export.

Rename createNodesV2 imports to createNodes

Section titled “Rename createNodesV2 imports to createNodes”

@nx/vite 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/vite/plugin to createNodes.

import { createNodesV2 } from '@nx/vite/plugin';
import { createNodes } from '@nx/vite/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.

Only static import/export named bindings from @nx/vite/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.

Version: 23.0.0-beta.10

The following packages will be updated:

NameVersionAlways add to package.json
vite^8.0.0Updated only
@vitejs/plugin-react^6.0.0Updated only

Version: 23.0.0-beta.22

The following packages will be updated:

NameVersionAlways add to package.json
vitest^3.0.0Updated only
@vitest/coverage-v8^3.0.0Updated only
@vitest/coverage-istanbul^3.0.0Updated only
@vitest/ui^3.0.0Updated only

Version: 23.0.0-beta.22

The following packages will be updated:

NameVersionAlways add to package.json
vitest^4.0.0Updated only
@vitest/coverage-v8^4.0.0Updated only
@vitest/coverage-istanbul^4.0.0Updated only
@vitest/ui^4.0.0Updated only

Version: 22.2.0-beta.1

Create AI Instructions to help migrate users workspaces past breaking changes for Vitest 4.

NameVersion
vitest>=4.0.0

Version: 22.2.0-beta.2

Migrate Vitest usage from @nx/vite to @nx/vitest package.

Version: 22.2.0-beta.1

The following packages will be updated:

NameVersionAlways add to package.json
vitest^4.0.0Updated only
@vitest/coverage-v8^4.0.0Updated only
@vitest/coverage-istanbul^4.0.0Updated only
@vitest/ui^4.0.0Updated only

Version: 22.2.0-beta.3

The following packages will be updated:

NameVersionAlways add to package.json
@analogjs/vite-plugin-angular~2.1.2Updated only

22.2.0-analog-vitest-angular-package-updates

Section titled “22.2.0-analog-vitest-angular-package-updates”

Version: 22.2.0-beta.3

The following packages will be updated:

NameVersionAlways add to package.json
@analogjs/vitest-angular~2.1.2Updated only

Version: 21.5.0-beta.0

The following packages will be updated:

NameVersionAlways add to package.json
vite^7.1.3Updated only

Version: 21.3.0-beta.3

The following packages will be updated:

NameVersionAlways add to package.json
@analogjs/vite-plugin-angular~1.19.1Updated only
@analogjs/vitest-angular~1.19.1Updated only

Version: 21.2.0-beta.3

The following packages will be updated:

NameVersionAlways add to package.json
@analogjs/vite-plugin-angular~1.17.1Updated only
@analogjs/vitest-angular~1.17.1Updated only

Version: 21.1.2-beta.0

The following packages will be updated:

NameVersionAlways add to package.json
@analogjs/vitest-angular~1.16.1Updated only