@nrwl/vite:build
Builds a Vite.js application for production.
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 builder executor description: This page contains examples for the Vite @nrwl/vite:build executor.
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": {
...
}
},
}
}