@nrwl/vite:build

Build 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.

project.json:

//... "my-app": { "targets": { //... "build": { "executor": "@nrwl/vite:build", //... //... "options": { "outputPath": "dist/apps/my-app" }, //... } }, } }
nx serve my-app

Examples

Nx will automatically look in the root of your application for a vite.config.ts (or a vite.config.js) file. If you want to use a different path, you can set it in your project.json file, in the build target options:

//... "my-app": { "targets": { //... "build": { "executor": "@nrwl/vite:build", //... "options": { "outputPath": "dist/apps/my-app", "configFile": "apps/my-app/vite.config.other-path.ts" }, "configurations": { ... } }, } }

or even

//... "my-app": { "targets": { //... "build": { "executor": "@nrwl/vite:build", //... "options": { "outputPath": "dist/apps/my-app", "configFile": "vite.config.base.ts" }, "configurations": { ... } }, } }

Options

baseHref

base
string

Base public path when served in development or production.

configFile

string

The name of the Vite.js configuration file.

fileReplacements

Default: []

Replace files with other files in the build.

logLevel

string
Accepted values: info, warn, error, silent

Adjust console output verbosity.

minify

oneOf [boolean, string]

Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.

manifest

oneOf [boolean, string]

Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.

mode

string
Accepted values: production, development

Mode to run the build in.

outputPath

string

The output path of the generated files.

proxyConfig

string

Path to the proxy configuration file.

sourcemap

oneOf [boolean, string]

Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.

ssrManifest

oneOf [boolean, string]

When set to true, the build will also generate an SSR manifest for determining style links and asset preload directives in production. When the value is a string, it will be used as the manifest file name.