remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.13k stars 1.72k forks source link

I need some assistance. it‘s not a bug but I didn't find the discussion tag. So I have to raise a question as an issue:does nodemon support running ts files? #2148

Closed Henrycheheng closed 7 months ago

Henrycheheng commented 7 months ago

i remember a time when nodemon could run ts files,but today i use pnpm init a project, and tsc --init, and then execute an index.ts demo error as follows, how can I run ts file in nodemon image

Henrycheheng commented 7 months ago

The dependencies and configurations are shown below image

Henrycheheng commented 7 months ago

I've figured out what's wrong with this. If you put "type": "module" in package.json, it will give you this error, So nodemon could currently only run ts files under the commonjs modular specification? image

Henrycheheng commented 7 months ago

The observation I made was that the node code failed to validate the .ts file, resulting in an error being thrown. image

remy commented 7 months ago

Not sure if this is nodemon or something else (I don't regularly use TS and when I do, it's typically with Deno, so I don't have all the tooling to mess with).

The file you've included a screenshot at the end, that's not from nodemon is it?

Not sure if this a documentation issue or something else can be done… happy to take advice.

Henrycheheng commented 7 months ago

Thank you for your reply. My last screenshot is indeed not an error caused by nodemon. In fact, node itself does not support ts files under esm. Thank you very much for your advice, I will give deno a try. Thank you again for your help,I have no more questions and I will close this issue soon.