@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.
title: Examples for the Vite preview server executor description: This page contains examples for the Vite @nrwl/vite:preview-server executor.
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": {
                ...
            }
        },
    }
}