Schema for internal use only

Please do not extend this schema as it is part of Nx internal usage.

@nrwl/vite:init

Initialize Vite in the workspace.


title: Examples for the Vite init generator description: This page contains examples for the Vite @nrwl/vite:init generator, which helps you initialize vite in your Nx workspace, by installing the necessary dependencies.


This is a generator will initialize Vite.js in your workspace. It will install all the necessary dependencies. You can read more about how this generator works, in the Vite package overview page.

string

You don't need to use this generator on its own.

This generator will be called automatically when you are either converting an existing React or Web app to use Vite, using the @nrwl/vite:configuration generator, or when you are creating a new React or Web app using the @nrwl/react:app or @nrwl/web:app generators, if you choose vite as the bundler.

If you need to for some reason, you can use it on its own like this:

nx g @nrwl/vite:init

Examples

Install all the necessary dependencies for Vite and the React plugin

nx g @nrwl/vite:init --uiFramework=react

Install all the necessary dependencies for Vite

nx g @nrwl/vite:init --uiFramework=none

Usage

nx generate init ...
nx g ng-add ... #same

By default, Nx will search for init in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

nx g @nrwl/vite:init ...

Show what will be generated without writing to disk:

nx g init ... --dry-run

Options

includeLib

boolean
Default: false

Add dependencies needed to build libraries.

uiFramework

string
Default: react
Accepted values: react, none

UI Framework to use for Vite.