ts-node & nodemon takes 2 minutes to start; too slow

Created on 26 Jun 2020  路  5Comments  路  Source: TypeStrong/ts-node

TL;DR Question

What I should do, to start my server in less than 1 minute?

Long-version Question

I have a Node.js server with Express (and TypeORM) that I want to run, but when I compile TypeScript it takes my every time 2 minutes to start, and it really gets annoying and moves you back in progress. I also use Nodemon to restart my server, but as you guess if it takes 2 minutes to run the server every time, Nodemon is really worthless for my case. I have searched on the internet but nothing seems to work out for me. Is there something else that I can use, or change my configuration somehow to compile faster?

Desired Behaviour
To have my Node.js server start at maximum 1 minute.

Alternatives I have considered
I have changed my config options in the tsconfig.json file, but nothing seems to fix the issue.

Additional context
I have been using the --transpile-only flag, and it still does not compile if 2 minutes have not passed.

Thanks for taking time to answer to my question and help me. I appreciate it a lot

Most helpful comment

I finally used tsc -w with nodemon & concurrently, and everything seems to work as expected, but again Node.js takes also some time to start the server. However, the compilation is really fast, as tsc -w uses incremental compilation, and does not recompile everything from the start as ts-node does.

Closing as no response was given by someone

All 5 comments

I finally used tsc -w with nodemon & concurrently, and everything seems to work as expected, but again Node.js takes also some time to start the server. However, the compilation is really fast, as tsc -w uses incremental compilation, and does not recompile everything from the start as ts-node does.

Closing as no response was given by someone

thank you

Your welcome!

@georgekrax can you share your package.json script?

Yes, it is ts-node -r tsconfig-paths/register src/index.ts. However, now that I have started to use it again it is faster, and this issue might have been caused due to a "buggy" version that I had installed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cibergarri picture cibergarri  路  3Comments

grissius picture grissius  路  3Comments

dakom picture dakom  路  3Comments

max-block picture max-block  路  4Comments

mattdell picture mattdell  路  4Comments