Advice on building on running a React app.

I need advice on how would I run a React App built with only TSX files.
No description
5 Replies
πŸŽ€π”Έβ„•π”Ύπ”Όπ•ƒ π”»π•†π•ƒπ•ƒπ”½π”Έβ„‚π”ΌπŸŽ€πŸ‡΅πŸ‡Έ
Assuming I build everything into a single *.js file and import that into a HTMl file.
kimbleton
kimbletonβ€’2w ago
so you want to run the already bundled and compiled js, is that the question? is this for developing or running for production use or for both? you can just use Deno.serve(..) with serveDir to serve your static built assets. that is ofc very brute way for developing. there are live reload modules available in JSR IIRC. but for example you can also use pm2 to watch files and do the build with esbuild and reload your page old school if you like
πŸŽ€π”Έβ„•π”Ύπ”Όπ•ƒ π”»π•†π•ƒπ•ƒπ”½π”Έβ„‚π”ΌπŸŽ€πŸ‡΅πŸ‡Έ
Basically just for dev. In "production" I just want to have some CSS, JS and HTML. That is then deployed to GH pages (that's easy)
kimbleton
kimbletonβ€’2w ago
maybe someone else can give you more 'latest n greatest' tip. I have unfortunately got myself stuck with webpack for my bundler. but vite seems to be hyped among the deno community so that might be something to consider to use as your dev server I did try this https://deno.land/x/refresh@1.0.0 and yea it worked for automatic refreshing but I went the pm2 route as I have that ready to go already. well now that I have opened my mouth I should maybe share my two cents where I have now a ts file with Deno.serve that is configured to host my static assets in a predetermined address and then I have pm2 ecosystem.config file where I have configured pm2 to watch files and run esbuild - basically prod build atm - when files change. The ecosystem file has also starts the Deno.serve(..) ts file so I can just run either an alias command or pm2 start in my repo root and my static hosting and watching for tsx and ts files starts
πŸŽ€π”Έβ„•π”Ύπ”Όπ•ƒ π”»π•†π•ƒπ•ƒπ”½π”Έβ„‚π”ΌπŸŽ€πŸ‡΅πŸ‡Έ
Then I'll drum up a small script to serve stuff Thanks for your help @kimbleton This is why I like Deno, I can write stuff I care about without any stupid presets. And nothing being forced on me.