@nx/vite - Migrations
For an overview of the plugin and setup instructions, see the @nx/vite introduction.
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.
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/vite executors, and @nx/vitest:test targets, to inferred tasks; an AI prompt finishes the targets the converter cannot convert safely and validates the project graph.
Convert @nx/vite and @nx/vitest:test targets to inferred tasks
Section titled “Convert @nx/vite and @nx/vitest:test targets to inferred tasks”Nx 24 removes the @nx/vite:build, @nx/vite:dev-server and @nx/vite:preview-server executors and their @nrwl aliases. The migration registers @nx/vite/plugin in nx.json and converts the targets that use those executors to inferred tasks. It moves build options into vite.config.*. It also converts @nx/vitest:test targets with the @nx/vitest converter, because @nx/vitest can be installed only as a transitive dependency and its own migration may not run. 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”The serve and preview targets have no options that differ from the inferred targets, so they are removed.
Before
Section titled “Before”{ "name": "myapp", "targets": { "build": { "executor": "@nx/vite:build", "outputs": ["{workspaceRoot}/dist/myapp"], "options": { "configFile": "myapp/vite.config.ts" } }, "serve": { "executor": "@nx/vite:dev-server", "options": { "buildTarget": "myapp:build" } }, "preview": { "executor": "@nx/vite:preview-server", "options": { "buildTarget": "myapp:build" } } }}{ "name": "myapp", "targets": { "build": { "options": { "config": "./vite.config.ts" } } }}{ "plugins": [ { "plugin": "@nx/vite/plugin", "options": { "buildTargetName": "build", "devTargetName": "dev", "previewTargetName": "preview", "serveStaticTargetName": "serve-static", "serveTargetName": "serve", "typecheckTargetName": "typecheck" } } ]}update-24-0-0-migrate-config-helpers
Section titled “update-24-0-0-migrate-config-helpers”Version: 24.0.0-beta.3
Replace nxViteTsPaths with Vite’s native resolve.tsconfigPaths, then migrate the remaining deprecated vite configuration helpers while preserving custom behavior.
update-24-0-0-register-typescript-plugin-for-typecheck
Section titled “update-24-0-0-register-typescript-plugin-for-typecheck”Version: 24.0.0-beta.3
Register @nx/js/typescript with its typecheck target in workspaces that use @nx/vite/plugin without it, since @nx/vite/plugin no longer infers typecheck targets except for Vue projects.
Register @nx/js/typescript for typecheck targets
Section titled “Register @nx/js/typescript for typecheck targets”@nx/vite/plugin no longer infers a typecheck target, except for Vue projects, which keep their vue-tsc target. @nx/js/typescript provides the typecheck target instead, in all workspaces. This migration registers @nx/js/typescript with only its typecheck target when the workspace uses @nx/vite/plugin and doesn’t register @nx/js/typescript yet, so your projects keep a typecheck target.
The new registration reuses the plugin’s typecheckTargetName and, when it’s tsgo, its compiler. Registrations with typecheckTargetName: false are skipped. @nx/js/typescript is registered before @nx/vite/plugin, so the Vue projects’ vue-tsc target wins. Keep that order.
Sample code changes
Section titled “Sample code changes”Before
Section titled “Before”{ "plugins": [ { "plugin": "@nx/vite/plugin", "options": { "typecheckTargetName": "typecheck" } } ]}{ "plugins": [ { "plugin": "@nx/js/typescript", "options": { "typecheck": { "targetName": "typecheck" } } }, { "plugin": "@nx/vite/plugin", "options": { "typecheckTargetName": "typecheck" } } ]}update-24-0-0-add-ready-signal-plugin
Section titled “update-24-0-0-add-ready-signal-plugin”Version: 24.0.0-beta.5
Add the nxReadySignal() plugin to the Vite configs of application projects, so that @nx/vite/plugin infers readyWhen: { signal: true } for their dev and preview targets; an AI prompt finishes the configs the codemod cannot edit safely.
Add the nxReadySignal() plugin to Vite configs
Section titled “Add the nxReadySignal() plugin to Vite configs”@nx/vite/plugin infers readyWhen: { signal: true } for the dev and preview targets of a project whose Vite config loads the nxReadySignal() plugin. The plugin reports the server’s address to Nx once it listens, so a task that depends on the server with waitFor: 'ready' starts when the server accepts requests. Without the plugin, the inferred check resolves the config when the task runs and waits for the configured port, which can pass early when Vite moves to another port.
This migration adds the import and nxReadySignal() to the plugins of the vite.config.{ts,mts,cts,js,mjs,cjs} file in each project root. It skips vitest.config.* files, projectType: 'library' projects, configs with build.lib and no server options, and configs that already load the plugin. It edits a config that exports a plain object, with or without defineConfig, and a factory that returns one, such as defineConfig(() => ({ ... })) or a function body with a single return. A config it can’t edit safely, such as a mergeConfig call, a config imported from a shared base, or a plugins array that spreads plugins from elsewhere, is left alone and listed. In agentic runs, an AI prompt finishes those configs.
Sample code changes
Section titled “Sample code changes”Before
Section titled “Before”import { defineConfig } from 'vite';import react from '@vitejs/plugin-react';
export default defineConfig(() => ({ root: import.meta.dirname, plugins: [react()],}));import { defineConfig } from 'vite';import react from '@vitejs/plugin-react';import { nxReadySignal } from '@nx/vite/plugins/nx-ready-signal.plugin';
export default defineConfig(() => ({ root: import.meta.dirname, plugins: [react(), nxReadySignal()],}));23.0.x
Section titled “23.0.x”ensure-vitest-package-migration-23
Section titled “ensure-vitest-package-migration-23”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.
ensure-vitest-package-migration (Nx v23)
Section titled “ensure-vitest-package-migration (Nx v23)”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.
What it does
Section titled “What it does”- Installs
@nx/vitest: added todevDependencieswhen vitest is detected in the workspace (skipped when already present or when the workspace does not use vitest at all). - Swaps
@nx/vite:testto@nx/vitest:test: updates everyproject.jsontarget and everytargetDefaultsentry that still references the removed executor. - Splits
@nx/vite/pluginregistrations: vitest-related options (testTargetName,ciTargetName,ciGroupName) are extracted from each@nx/vite/pluginentry and moved to a new@nx/vitestplugin entry. The vite entry is updated to retain only build/serve/preview options. - Registers
@nx/vitestplugin: for workspaces that used@nx/vite/pluginin its default configuration (no vitest options), a matching@nx/vitestplugin entry is added automatically so vitest targets continue to be inferred.
Why this migration exists
Section titled “Why this migration exists”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.
No action required
Section titled “No action required”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.
rename-rollup-options-to-rolldown-options
Section titled “rename-rollup-options-to-rolldown-options”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.
Requires
Section titled “Requires”| Name | Version |
|---|---|
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.
Sample Code Changes
Section titled “Sample Code Changes”Top-level rename inside build.
Before
Section titled “Before”export default defineConfig({ build: { rollupOptions: { external: ['react'], }, },});export default defineConfig({ build: { rolldownOptions: { external: ['react'], }, },});The same rename applies inside environments.<env>.build.
Before
Section titled “Before”export default defineConfig({ environments: { ssr: { build: { rollupOptions: { external: ['fs'] }, }, }, },});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.manualChunksonly accepts a function in Rolldown (the object-of-globs form is invalid). Seetools/ai-migrations/MIGRATE_VITE_8.md(created by a sibling migration) for the full Vite 8 upgrade checklist.
create-ai-instructions-for-vite-8
Section titled “create-ai-instructions-for-vite-8”Version: 23.0.0-beta.10
Create AI Instructions to help migrate users workspaces past breaking changes for Vite 8.
Requires
Section titled “Requires”| Name | Version |
|---|---|
vite | >=8.0.0 |
migrate-to-vitest-3
Section titled “migrate-to-vitest-3”Version: 23.0.0-beta.22
Migrate workspaces past breaking changes for Vitest 3.
Requires
Section titled “Requires”| Name | Version |
|---|---|
vitest | >=3.0.0 |
migrate-to-vitest-4
Section titled “migrate-to-vitest-4”Version: 23.0.0-beta.22
Migrate workspaces past breaking changes for Vitest 4.
Requires
Section titled “Requires”| Name | Version |
|---|---|
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.
Sample Code Changes
Section titled “Sample Code Changes”Before
Section titled “Before”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.
What is not rewritten
Section titled “What is not rewritten”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.
23.0.0-package-updates
Section titled “23.0.0-package-updates”Version: 23.0.0-beta.10
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
vite | ^8.0.0 | Updated only |
@vitejs/plugin-react | ^6.0.0 | Updated only |
23.0.0-vitest-v3-floor-package-updates
Section titled “23.0.0-vitest-v3-floor-package-updates”Version: 23.0.0-beta.22
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
vitest | ^3.0.0 | Updated only |
@vitest/coverage-v8 | ^3.0.0 | Updated only |
@vitest/coverage-istanbul | ^3.0.0 | Updated only |
@vitest/ui | ^3.0.0 | Updated only |
23.0.0-vitest-v4-package-updates
Section titled “23.0.0-vitest-v4-package-updates”Version: 23.0.0-beta.22
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
vitest | ^4.0.0 | Updated only |
@vitest/coverage-v8 | ^4.0.0 | Updated only |
@vitest/coverage-istanbul | ^4.0.0 | Updated only |
@vitest/ui | ^4.0.0 | Updated only |
22.2.x
Section titled “22.2.x”update-22-2-0
Section titled “update-22-2-0”Version: 22.2.0-beta.1
Create AI Instructions to help migrate users workspaces past breaking changes for Vitest 4.
Requires
Section titled “Requires”| Name | Version |
|---|---|
vitest | >=4.0.0 |
migrate-vitest-to-vitest-package
Section titled “migrate-vitest-to-vitest-package”Version: 22.2.0-beta.2
Migrate Vitest usage from @nx/vite to @nx/vitest package.
22.2.0-package-updates
Section titled “22.2.0-package-updates”Version: 22.2.0-beta.1
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
vitest | ^4.0.0 | Updated only |
@vitest/coverage-v8 | ^4.0.0 | Updated only |
@vitest/coverage-istanbul | ^4.0.0 | Updated only |
@vitest/ui | ^4.0.0 | Updated only |
22.2.0-analog-package-updates
Section titled “22.2.0-analog-package-updates”Version: 22.2.0-beta.3
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@analogjs/vite-plugin-angular | ~2.1.2 | Updated 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
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@analogjs/vitest-angular | ~2.1.2 | Updated only |
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.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
vite | ^7.1.3 | Updated only |
21.3.x
Section titled “21.3.x”21.3.0-package-updates
Section titled “21.3.0-package-updates”Version: 21.3.0-beta.3
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@analogjs/vite-plugin-angular | ~1.19.1 | Updated only |
@analogjs/vitest-angular | ~1.19.1 | Updated only |
21.2.x
Section titled “21.2.x”21.2.0-package-updates
Section titled “21.2.0-package-updates”Version: 21.2.0-beta.3
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@analogjs/vite-plugin-angular | ~1.17.1 | Updated only |
@analogjs/vitest-angular | ~1.17.1 | Updated only |
21.1.x
Section titled “21.1.x”21.1.2-package-updates
Section titled “21.1.2-package-updates”Version: 21.1.2-beta.0
Packages
Section titled “Packages”The following packages will be updated:
| Name | Version | Always add to package.json |
|---|---|---|
@analogjs/vitest-angular | ~1.16.1 | Updated only |