Deploying vite apps to dokku
Today I did the classic Todo app as a warmup/practice problem. I used viteto quickly scaffold out a typescript + react app, got to work and had a working app pretty quickly. I try to deploy everything I make because it doesnât feel real as long as itâs just on my computer. So I wanted to deploy to my dokku instance. Hereâs what works:
- Add the
serve
node module:yarn add serve
- In
package.json
add a key forstart
that looks like:"start": "serve -s dist"
When dokku does the deploy itâll figure out that the this is a node app, run build
(which compiles the typescript to JS) then run serve
which will serve the dist
folder. And just like that the app is built and served.
Hereâs my todo app for the very curious. Itâs 15 minutes of work so it doesnât have any styling or niceties but it works!