logoalt Hacker News

mooglytoday at 3:53 PM1 replyview on HN

I transpile for prod, but use --strip-types when running in dev, and all I had to do was to make a 10-line ESM register hook that rewrites .js to .ts if the .js import fails, and then a one-liner import register trampoline script. Not sure I'd do that in prod, but works fine in dev at least.

This way I could just use node --watch instead of tsx or nodemon.


Replies

ivanjermakovtoday at 4:36 PM

Mind sharing the implementation? I think it's basically what tsx is doing when used in `node --import tsx`.

show 1 reply