@rollin
To deploy a Vite React.js app in Heroku, you can follow these steps:
- Make sure you have the Heroku CLI installed on your machine. You can download it from https://devcenter.heroku.com/articles/heroku-cli.
- Create a new Heroku app by running the following command in your terminal:
1
|
heroku create <app-name>
|
- Add a build script to your package.json file that builds your Vite React.js app for production. You can do this by adding the following script:
1
2
3
|
"scripts": {
"build": "vite build"
}
|
- Create a new file named "Procfile" in the root of your project and add the following line to it:
- Commit your changes to your Git repository by running the following commands:
1
2
|
git add .
git commit -m "Added build script and Procfile"
|
- Push your code to your Heroku app by running the following command:
- Once the deployment is complete, open your Heroku app by running the following command:
Your Vite React.js app should now be deployed and accessible on Heroku.