Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.4K
Visualizações
Is it a bad practise to use ts-node in production?

I'm currently using ts-node with express in production and it's working well so far. Is there any reason that I should compile and run .js instead?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

No you shouldn't use it in production, even though it will cache the compiled files it'll be slower to start and consume more memory because it keeps around an instance of the compiler and files in memory.

It's better practice to compile the files beforehand with whatever build tooling you're using to make sure builds actually pass if for some reason your development environment and production might differ (this depends how your workflow looks like).

One case might be that you want to stop deployment if the app fails to actually build before deploying it and trying to run it and replace the running instance. An example might look like:

yarn
yarn build // tsc index.ts (possibly returns 1, stop build and output error)
yarn start // node index.js
over 4 years ago · Santiago Trujillo Relatório

0

You should build the server on your dockerfile and for development mix tsc + nodemon.

https://github.com/TypeStrong/ts-node As they said in their docs "Is currently experimental".

over 4 years ago · Santiago Trujillo Relatório

0

According to Blake Embrey, the author of ts-node, you can use it in production BUT you should use it with the --transpile-only flag.

Example:

ts-node --transpile-only ./src/start.ts

If you are compiling with transpile only, it will have a lower memory footprint as no type information will be generated. However, it can come to problems when you are using reflect-metadata (with experimental support for decorators).

In short: Use ts-node --transpile-only (there is also ts-node-transpile-only) in production when you are not using reflect-metadata. Otherwise, use tsc in combination with classic node.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda