Deployment
Your React client will run in development mode by default. When you want to deploy to a live server, you must build the front-end and serve the static files.
You can run this file before you deploy or set it as a post-build
script in package.json
if your hosting provider supports post-build scripts. Gravity includes the Heroku post-build
script for you already.
You need to set server.open to false in vite.config.js before deploying.
Running The Client & Server Together
If you want to serve the static files in the same production environment as your server, you will need to add the following lines to server.js
Environment Variables
You must ensure you set up your environment variables in your production environment.
Heroku Deployment Tutorial
Last updated