Closed
Description
- Versions: [email protected], [email protected]
nodemon -v
: 2.0.20- Operating system/terminal environment (powershell, gitshell, etc): macOS, Terminal.app, zsh
- Using Docker? What image: no
- Command you ran:
NODE_OPTIONS='--loader @esbuild-kit/esm-loader' nodemon src/server.ts
Expected behaviour
I was expecting @esbuild-kit/esm-loader
being used to load my TypeScript files, as that is the case when I run NODE_OPTIONS='--loader @esbuild-kit/esm-loader' node src/server.ts
(same command but with node
instead of nodemon
).
Actual behaviour
It uses ts-node
in order to transpile the TypeScript files.
I only noticed this because source maps wasn't working properly, and upon investigating that I realised that nodemon
had actually used ts-node
to transpile the typescript files.
Steps to reproduce
- Create the following
package.json
file{ "type": "module", "dependencies": { "@esbuild-kit/esm-loader": "^2.5.0", "nodemon": "^2.0.20" } }
- Run
npm install
- Create the following
index.ts
file:const test = (foo: string) => { throw new Error(foo) } test('foo')
- Run
NODE_OPTIONS='--loader @esbuild-kit/esm-loader' node index.ts
- Observe nice stack trace
- Run
NODE_OPTIONS='--loader @esbuild-kit/esm-loader' nodemon index.ts
-
failed to start process, "ts-node" exec not found