@nrwl/vite:dev-server
Starts a dev server using Vite.
Options can be configured in project.json
when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.
title: Examples for the Vite dev server executor description: This page contains examples for the Vite @nrwl/vite:dev-server executor.
project.json
:
//...
"my-app": {
"targets": {
//...
"serve": {
"executor": "@nrwl/vite:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "my-app:build",
},
"configurations": {
...
}
},
}
}
nx serve my-app
Examples
You can always set the port in your vite.config.ts
file. However, you can also set it directly in your project.json
file, in the serve
target options:
//...
"my-app": {
"targets": {
//...
"serve": {
"executor": "@nrwl/vite:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "my-app:build",
"port": 4200,
},
"configurations": {
...
}
},
}
}