Vite dev server.
@nx/vite
Package reference
Here is a list of all the executors, generators and migrations available from this package.
Executors
Build with Vite.
Test with Vitest
Vite preview server
Generators
initInternal
Initialize Vite in the workspace.
Add Vite configuration to an application.
Sets up the nxViteTsPaths plugin to enable support for workspace libraries.
Convert existing Vite project(s) using
@nx/vite:*
executors to use@nx/vite/plugin
. Defaults to migrating all projects. Pass '--project' to migrate only one target.Generate a vitest configuration.
Migrations
21.1.x
20.7.x
20.5.x
20.3.x
20.0.x
19.6.x
21.1.2-package-updates
Packages
Name | Version | Always Add to package.json |
---|---|---|
@analogjs/vitest-angular | ~1.16.1 | Update only |
20.7.1-package-updates
Packages
Name | Version | Always Add to package.json |
---|---|---|
@analogjs/vite-plugin-angular | ~1.14.1 | Update only |
@analogjs/vitest-angular | ~1.14.1 | Update only |
update-20-5-0-update-resolve-conditions
Update resolve.conditions to include defaults that are no longer provided by Vite.
Update resolve.conditions
to include defaults
In previous Vite versions, the resolve.conditions
option had defaults that were added internally (i.e. ['module', 'browser', 'development|production']
).
This default was removed in Vite 6, so this migration adds it to your existing configuration to ensure that the behavior remains intact.
Learn more: https://vite.dev/guide/migration#default-value-for-resolve-conditions
Remix does not currently support Vite 6 and therefore any vite.config
file for Remix will not be migrated.
Sample Code Changes
1import { defineConfig } from 'vite';
2
3export default defineConfig({
4 resolve: {
5 conditions: ['require'],
6 },
7 build: {
8 outDir: 'dist',
9 },
10});
11
eslint-ignore-vite-temp-files
Add vite config temporary files to the ESLint configuration ignore patterns if ESLint is used.
Sample Code Changes
Add vite.config.*.timestamp*
and vitest.config.*.timestamp*
to the root eslint.config.mjs
file (using ESLint Flat Config).
1export default [
2 {
3 ignores: ['dist'],
4 },
5];
6
Add vite.config.*.timestamp*
and vitest.config.*.timestamp*
to the project's .eslintrc.json
file (using eslintrc format config).
1{
2 "ignorePatterns": ["!**/*"]
3}
4
20.5.0-package-updates
Packages
Name | Version | Always Add to package.json |
---|---|---|
vite | ^6.0.0 | Update only |
vite-plugin-dts | ~4.5.0 | Update only |
update-20-5-0-install-jiti
Install jiti as a devDependency to allow vite to parse TS postcss files.
Installs the jiti
package
This migration ensures that the jiti
package is installed.
This is a requirement for Vite to parse postcss
configuration files that use TypeScript.
Learn more: https://vite.dev/guide/migration#postcss-load-config
update-20-3-0
Add gitignore entry for temporary vitest config files.
Add Vitest Temp Files to Git Ignore
Add gitignore entry for temporary vitest config files.
Sample Code Changes
Adds the following entries to the .gitignore
file.
1vite.config.*.timestamp*
2vitest.config.*.timestamp*
3
update-20-0-6
Add gitignore entry for temporary vite config files and remove previous incorrect glob.
Add Vite Temp Files to Git Ignore
Add gitignore entry for temporary vite config files.
Sample Code Changes
Adds the following entries to the .gitignore
file.
1vite.config.*.timestamp*
2vitest.config.*.timestamp*
3
update-20-0-4
Add gitignore entry for temporary vite config files.
Add Vite Temp Files to Git Ignore
Add gitignore entry for temporary vite config files.
Sample Code Changes
Adds the following entries to the .gitignore
file.
1vite.config.*.timestamp*
2vitest.config.*.timestamp*
3
update-19-6-0-add-depends-on-for-preview-server
Add dependsOn: [build] to preview targets using preview-server