For my /garden
page I have a tiny bit of JavaScript that's used to make the tooltips appear.
This is fine for this page and works but the problem becomes when you need more complexity.
When there's more complexity and dependencies being used you need to use TypeScript to get the job done.
In this case what I can do is:
- Write the non interactive server rendered HTML
- Create a new
vite
project
bunx create-vite my-js-ts-app --template vanilla-ts
- Copy the HTML into the
index.html
- Add all the dependencies and make the app do what it needs to do using the
main.ts
- Build the app
npm run build
- Copy the
.js
output from thedist
- Add this to my server rendered app with a
defer
tag so it loads after the HTML