Skip to content
jshacks.dev
Tooling

Create a Vite project from a template

Create a Vite project from a template with npm create vite, choose the vanilla-ts or react-ts template and see which files it generates.

1 min read
Summarize in AI

create-vite scaffolds a project from a template. It asks for a name and a framework, or takes them as arguments.

Shell
npm create vite@latest my-app -- --template vanilla-ts
cd my-app
npm install
npm run dev
Text
my-app/
├─ index.html
├─ package.json
├─ tsconfig.json
├─ public/
│  └─ vite.svg
└─ src/
   ├─ main.ts
   ├─ counter.ts
   ├─ style.css
   └─ typescript.svg

The -- hands --template to the create script rather than to npm. Other templates include react-ts, vue-ts, svelte-ts and solid-ts, and the plain names without -ts give JavaScript. Vite's index.html sits at the project root because it is the entry point: the dev server serves it and follows its script tag. The exact file list changes between template versions. See the Vite getting started guide.

Vite 7 needs Node.js 20.19 or 22.12 and later. Run npm run build to produce a dist/ folder for any static host.

Share

More snippets

Tooling

Configure VS Code settings for a team

Share VS Code settings and recommended extensions with a team by committing a .vscode folder with settings.json and extensions.json.

1 min read
Tooling

Share an ESLint config across packages

Share one ESLint 9 flat config across workspace packages by exporting an array from a package and spreading it into each package's eslint.config.js.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.