Distinguish development from production builds
Development and production are different jobs
During development, Vite serves source modules and supports fast feedback when files change. A production build prepares deployable files for the browser. The preview command serves a previously built output locally so you can inspect it. It is not intended to be a production web server. All commands below are conditional on a reviewed, installed local project.
{ "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }}The script names are shortcuts for local Vite commands. The excerpt is not a complete package manifest: a real project also needs reviewed dependencies and related metadata. The fixture supplies a separate Vite configuration showing how the React plugin is connected.
npm run dev -- --host 127.0.0.1# Stop the dev server with Ctrl+C before continuing.npm run buildnpm run preview -- --host 127.0.0.1Open the loopback address printed by the development server. Edit the heading and confirm the change. Stop the server, run the build, and only if the build succeeds start preview. Open the address printed by preview and confirm the updated heading. Stop preview with Ctrl+C. Ports can differ if already occupied; read the actual terminal output. No server should be exposed publicly for this practice.
What goes into a build?
dist/ index.html assets/ index-<generated-hash>.jsA typical client-only build emits a transformed HTML entry and JavaScript assets, plus CSS or other assets if required. Hashes and exact file counts are not fixed. The default output folder is dist unless configuration changes it. If you edit source after a build, preview does not automatically produce a new production build. Rebuild before checking the change. A suitable static host can serve these files; hosting configuration, asset base paths and routing fallbacks matter for larger applications.
Common mistakes
A successful build is not proof of correct behavior. Test the page and check browser errors separately. Do not deploy the development server or preview server as your production solution. Do not put secrets in client code or assume build-time configuration makes secrets private: assets are delivered to visitors. Keep the dependency lockfile for reproducible installs; it does not replace security review.
Practice
Given a scenario where development shows a changed title but preview still shows the previous title, explain the missing step. Use the staged verification checklist to inspect the build and the actual page once a reviewed environment is available. Next: JSX syntax and expressions.