@nrwl/vite:preview-server

Preview 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": { //... "preview": { "executor": "@nrwl/vite:preview-server", "defaultConfiguration": "development", "options": { "buildTarget": "my-app:build", }, "configurations": { ... } }, } }
nx preview 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 preview target options:

//... "my-app": { "targets": { //... "preview": { "executor": "@nrwl/vite:preview-server", "defaultConfiguration": "development", "options": { "buildTarget": "my-app:build", "port": 4200, }, "configurations": { ... } }, } }

Options

buildTarget

Required
string

Target which builds the application.

host

oneOf [boolean, string]

Specify which IP addresses the server should listen on.

proxyConfig

string

Path to the proxy configuration file.

port

number

Port to listen on.