Create a Project with Vite

Create the App

Vite is the recommended way to start a plain React app: it starts instantly and reloads on save.

Example

Create a project called my-app, install dependencies and start the dev server:

npm create vite@latest my-app -- --template react
cd my-app
npm install
npm run dev

Example output

  VITE v6.0.0  ready in 300 ms

  ➜  Local:   http://localhost:5173/
  ➜  press h + enter to show help

Note: Use the react-ts template instead of react for TypeScript.

Useful Commands

CommandWhat it does
npm run devstart the development server with hot reload
npm run buildcreate an optimised production build in dist/
npm run previewserve the production build locally to test it
npm run lintcheck the code with ESLint
npm install axiosadd a library to the project