Build and deploy the React and Vite starter
Create and preview a production build locally:
Code
Vite writes static output to dist. Deploy that directory with a static host or place it behind
your application server.
Hosting requirements
The starter uses browser routing. Configure the host to serve index.html as the fallback for
application routes such as /contact/standard; otherwise direct navigation to those URLs can
return the host's 404 page.
The default connector proxy exists only in the development server. Production submission must use
an application-owned server endpoint. Configure that endpoint explicitly rather than assuming the
development /api proxy will be present after deployment.
Before deployment
- Run
npm run lintandnpm run build. - Review the generated bundle-size warning and introduce code splitting when application growth makes the initial download inappropriate.
- Keep local
.envfiles out of version control. - Confirm that no secrets are embedded in the generated assets.
- Test direct navigation to every public application route.
- Review the security policy.
Vite environment values intended for browser code are statically embedded at build time. Treat them as public configuration, even when they originate in a local environment file.