Vite development and production workflows
Quick answer
Vite offers a development server and a production build command. The dev server is for editing and fast feedback; the production build prepares deployable assets.
Tooling examples
Example 1. Context: projects/vite-lab. Run in a fresh prepared fixture copy; see its README. Manual integration example — not executed here.
npm run devExpected observation: Development server starts at the URL printed by Vite.
Example 2. Context: projects/vite-lab. Run in a fresh prepared fixture copy; see its README. Stop the previous dev server first; preview is long-running. Manual integration example — not executed here.
npm run buildnpm run previewExpected observation: Build emits assets and preview serves the build locally.
How the tooling works
Use a reviewed, version-pinned Vite project. Install its locked dependencies, run npm run dev during editing and npm run build to produce the configured output directory (normally dist). Hot module replacement can preserve some application state depending on integration; it is not a production feature. npm run preview serves the built output for local verification, not a hardened production host. The provided vite-lab is an unexecuted setup template: select a compatible Vite release and create its lockfile in an approved network environment first.
Common mistakes
Do not deploy the development server publicly as a production web server.
Practice
After selecting a supported Vite version, build the lab, inspect dist, preview it and compare changes made during dev with the final production output.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Vite development and production workflows — Knowledge Check
Assess tooling contracts, diagnostic reasoning and transfer to a project.
Which Vite command produces production assets with the usual script setup?
What is vite preview intended for?
What is a prerequisite for repeating a Vite build consistently?
In Vite development and production workflows, what is the expected observation for example 1 in its documented setup? npm run dev
In Vite development and production workflows, what is the expected observation for example 2 in its documented setup? npm run build npm run preview