Deploying an app using Vite on Heroku

Vite Heroku logos
0 0
Read Time:49 Second

As I’ve just stumbled about some problems deploying an app using Vite on heroku.com, I thought I might just help and spread the word (or article) from Harry Laoulakos’ blog. Before I kept having problems with opening my app – the deployment worked fine, but then my app kept going from starting to crashed or, depending on what I tried, going into a timeout error as the port couldn’t be bound within 60 seconds.

I already had heroku/nodejs added as buildpack as he suggests:
Heroku buildpack config view
The heroku/nodejs buildpack selected as buildpack for an app
The crucial changes for my setup were to add the following to my package.json
    "postinstall": "npm run build",
    "serve-heroku": "vite --host 0.0.0.0 --port $PORT preview",

and, to go alongside with it, create a Procfile (not Profile) file with the following content:

web: npm run serve-heroku

Hope this helps in case you run into similar issues.

About Post Author

tim

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

One thought on “Deploying an app using Vite on Heroku

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.