Compatibility Note: Vite requires Node.js version >=12.0.0.
With NPM:
$ npm init @vitejs/app
With Yarn:
$ yarn create @vitejs/app
With PNPM:
$ pnpx @vitejs/create-app
Then follow the prompts!
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a Vite + Vue project, run:
# npm 6.x
npm init @vitejs/app my-vue-app --template vue
# npm 7+, extra double-dash is needed:
npm init @vitejs/app my-vue-app -- --template vue
# yarn
yarn create @vitejs/app my-vue-app --template vue
# pnpm
pnpx @vitejs/create-app my-vue-app --template vue
Currently supported template presets include:
vanilla
vanilla-ts
vue
vue-ts
react
react-ts
preact
preact-ts
lit-element
lit-element-ts
svelte
svelte-ts
@vitejs/create-app is a tool to quickly start a project from a basic template for popular frameworks. Check out Awesome Vite for community maintained templates that include other tools or target different frameworks. You can use a tool like degit to scaffold your project with one of the templates.
npx degit user/project my-project
cd my-project
npm install
npm run dev
If the project uses main
as the default branch, suffix the project repo with #main
npx degit user/project#main my-project