What is Vite?

In short
Vite is a build tool for modern web projects. It gives you a fast development server that shows your changes almost instantly, and a build command that packages your code for production. It is a good starting point for beginners building websites with JavaScript.
What Vite does
Vite is a build tool. A build tool takes the files you write, such as JavaScript, CSS and HTML, and turns them into a form that browsers can load quickly. The name is the French word for "quick", and the project aims to make the development experience faster and lighter than older tools.
Vite has two main parts. The first is a development server. While you work, it serves your project to the browser and updates the page as you save files. It uses a feature called Hot Module Replacement, which swaps only the changed piece of code into the running page, so you rarely need a full reload.
The second part is a build command. When your project is ready to publish, it bundles your code into optimized static files. Static files are plain files, like HTML, CSS and JavaScript, that any web server can host without running code on the server.
How it works
During development, Vite lets the browser load your source modules directly, using native ES modules, which are the standard way browsers import JavaScript. Vite adds extra features on top of that, so the dev server stays fast even in larger projects.
Vite comes with sensible defaults, so many projects work without configuration. If you need to change something, you can use a config file. Support for frameworks and other tools is added through plugins. The official documentation explains these options in more detail.
During development, Vite assumes a modern browser. For production builds, it targets browser versions that are widely supported, and you can lower that target through configuration if you need older browsers.
Starting a project
The quickest way to begin is to scaffold a project with the create-vite tool. With npm, you run npm create vite@latest, then follow the prompts. You can also pass a project name and a template on the command line. For example, a Vue project can be started with a template option.
Vite requires Node.js version 20.19 or higher, or 22.12 or higher. Node.js is the runtime that runs Vite on your computer. If your package manager warns about a version mismatch, upgrade Node.js before continuing.
If you prefer to add Vite to an existing project, install it as a development dependency with npm install -D vite. Then create an index.html file and run npx vite. The page is served on http://localhost:5173 by default.
A simple example
A scaffolded project usually includes a package.json file with a few scripts. The dev script starts the development server, the build script creates production files, and the preview script lets you check the production build locally.
{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}
You run these with npm run dev, npm run build and npm run preview. The index.html file sits in the project root, which is the folder Vite serves from. In Vite, index.html is the entry point of your application, so it is placed at the top level rather than hidden in a public folder.
Common mistakes
A common mistake is moving the project root without moving the config file. Vite looks for its configuration file, such as vite.config.js, inside the project root, so both must stay together.
Another mistake is forgetting that the development server and the production build are different. Something that works in npm run dev should also be checked with npm run build and npm run preview before you publish.
Finally, avoid relying on a Node.js version that is too old. Check your version before installing, so you do not hit confusing errors later.
Alternatives
Vite is not the only build tool. Other popular options exist, and each has its own strengths. If you already use a framework that ships with its own tooling, check its documentation first. Vite is a solid choice when you want a fast dev server, simple defaults and the freedom to add plugins when you need them. You can read the official guide at https://vite.dev/guide/ to decide whether it fits your project.
FAQ
Do I need to know JavaScript before using Vite?
Some basic JavaScript knowledge helps, because Vite builds and serves JavaScript projects. You do not need deep expertise to start, since the scaffolding tool creates a working project for you.
Is Vite only for Vue or React projects?
No. Vite supports many frameworks, including Vue, React, Svelte and others, and it also works with plain JavaScript and TypeScript. Frameworks are added through templates and plugins.
What is the difference between vite and vite build?
Running vite starts the development server. Running vite build creates optimized static files for production. You use the dev server while coding and the build command before publishing.
Which Node.js version do I need for Vite?
Vite requires Node.js 20.19 or higher, or 22.12 or higher. Some templates need a newer version, so upgrade if your package manager shows a warning.
Sources
This page is based on the official documentation below. Read it for full detail.
Vite — official documentation ↗