After a lot of searching, I found this solution works perfect:
https://github.com/TypeStrong/ts-node/issues/922#issuecomment-673155000
Just add a "ts-node"
block to your tsconfig.json
file as below:
{ "ts-node": { "compilerOptions": { "module": "commonjs" } }, "compilerOptions": { "module": "esnext" } }
And it has been documented in the ts-node official page “Via tsconfig.json” part.
This saved hours of my life.