Without using a framework, how do I compile natively supported TS in Deno into static JS?
If I am not mistaken, this used to be possible with the built in bundler which is now gone. How do we go from dev-time TS to prod-time JS without a framework or custom transpiler in the middle? Basically, help me get from deno init to deno "prod" - how to turn those main.ts files into runnable js?
4 Replies
You could try a simple util like https://jsr.io/@ndh/build
Or, even better; roll-your-own!
Create the following module -- builder.ts
Just modify the entrypoints and outfile to suit your needs.
You can also specify to bundle or not, and minification or not.
Add the above module to you project root. Then just to run:
Or just go to the repo:
https://github.com/nhrones/Hot_BuenoCache
deno run -A --quiet builder.tsYou could also add this as a task in deno.json called build. For a working example see: https://nhrones.github.io/Hot_BuenoCache/ Click the see-the-code link on the bottom left of the page!
Or just go to the repo:
https://github.com/nhrones/Hot_BuenoCache
Beautiful, thanks 🙂 Let me check this out
Just use EsBuild. It's great. Deno don't have any options to compile ts into js.
yeah this works great