ts-node: ts-node & nodemon takes 2 minutes to start; too slow
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
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 18
I finally used
tsc -w
withnodemon
&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, astsc -w
uses incremental compilation, and does not recompile everything from the start asts-node
does.Closing as no response was given by someone
I’m talking about using this: https://typestrong.org/ts-node/docs/swc
I stumbled upon this exact same problem, and my only solution was to install and use ts-node-dev (essentially replacing nodemon). It is way faster and apparently very much optimized for ts. You might wanna give it a go if you haven’t already 😄
You probably want to use the
--swc
flag.