Create a React App with Vite

Scaffold a React + TypeScript project with Vite, run the dev server, and produce a production build.

beginner8 minallUpdated August 2026
#react#vite#javascript#typescript#frontend

Requirements

0/4 steps · 0%
01

Scaffold the project

bash
$ npm create vite@latest {{PROJECT_NAME}} -- --template react-ts

Swap react-ts for react if you'd rather skip TypeScript. Vite also supports Vue, Svelte, and several other templates.

02

Install dependencies

bash
$ cd {{PROJECT_NAME}}
$ npm install
03

Start the dev server

bash
$ npm run dev

Expected output

  VITE v5.x.x  ready in 320 ms
  ➜  Local:   http://localhost:5173/

Open the printed URL. Edits to any component hot-reload instantly without losing component state.

04

Build for production

bash
$ npm run build

Output goes to dist/ — minified, hashed for cache-busting, and ready to deploy to any static host. Preview the production build locally before shipping it:

bash
$ npm run preview

Success

You have a working React app with a fast dev loop and an optimized production build.

Troubleshooting

Either the path has a typo, or the package it points to was never installed.

bash
$ npm install

If the import is a local file, double-check the relative path and file extension.