← Back to context

Comment by ivanjermakov

9 hours ago

Running typescript without compilation is still tricky with plain Node. `vite dev` has amazing DX not available for Node programs. I'm wondering if Vite+ tackles this problem.

Don't we have `tsx` and `nodemon` (or the native Node reloader) for that? What are the DX gaps you see on the server side out of on-the-fly transpilation and reload on watch?

  • Yes, I use tsx for Node programs. It's not great when sharing the same codebase for both client and server code, they have completely different dev workflows.

  • One advantage of precompilation is risk reduction. Say tsx gets hacked somehow (hardly unprecedented with Node modules!) you’ve got it running on your production server exposed to the internet. Precompilation on a CI pipeline is still a risk but a significantly lower one.

    • If only the whole JavaScript wasn't as dependency hell of single function packages....

  • In theory, typescript doesn't need to be transpiled, you can run ts files using `node --experimental-strip-types file.ts` as long as you don't use any code that needs transpilation (like typescript enums).

    Still need tsx to do type checking