Search code examples
node.jstypescriptproduction-environmentts-node

Should I transpile my TypeScript application?


I recently started building a small project with TypeScript. It is a small application that runs some workflows based on received Webhook calls. This means that it exposes an Express app to handle these requests.

Currently I have an npm script that builds this project and transpiles it into JavaScript which can be then interpreted by Node.js. (The script runs: tsc --build --clean)

My question is, since this is not meant to be a library/package that will be published on NPM, is there any reason to transpile the project at all since I can just run it with ts-node?

I've been looking around for some information regarding this but couldn't find anything.

Are there any security, performance or any other implications when running the project directly with ts-node in a production environment instead of building it and running it with node?


Solution

  • It depends on the size of your project. Most people transpile because it improves performance, consumes less system resources and provides more stability.

    But in a small project this won't make much difference, so using ts-node may be sufficient.