@nrwl/vite:dev-server

Dev server for 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.

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": { ... } }, } }

Options

buildTarget

string

Target which builds the application.

baseHref

string

Base url for the application being built.

fileReplacements

Default: []

Replace files with other files in the build.

host

oneOf [boolean, string]
Default: localhost

Specify which IP addresses the server should listen on.

https

boolean
Default: false

Serve using HTTPS.

hmr

boolean
Default: false

Enable hot module replacement. For more options, use the 'hmr' option in the Vite configuration file.

proxyConfig

string

Path to the proxy configuration file.

port

number
Default: 4200

Port to listen on.