Closed LinusU closed 1 year ago
I'm not really familiar with TypeScript (mostly intentionally), but going by the steps you've included, it looks like a good work around would be to not use the ts-code
thing if there's NODE_OPTIONS
set.
Would that sound about right?
NODE_OPTIONS
can be used to pass any options that could also be given to node
via passing cli arguments, so potentially it's used for other things where people want the ts-node
behaviour. Maybe checking if --loader
is present in NODE_OPTIONS
is a better approach?
Personally, I would drop ts-node
from the default execMap
, since there is multiple programs that run .ts
file (e.g. Deno). And just inside node
there are multiple solutions other than ts-node
(e.g. tsx
).
I'd be happy to submit a PR for any of the above approaches βΊοΈ
I genuinely don't care about TS support, but it's been in nodemon for too long that removing it would probably break expectations.
I think checking the --loader
is the best (soft) approach that could solve this issue.
Sounds good π
Where in the code do you think it would be best to add the check? In nodemon/lib/config/defaults.js
?
I'm thinking something like (process.env.NODE_OPTIONS || '').includes('--loader')
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
ping @remy, do you have any thoughts on my last question?
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
friendly ping @remy
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
friendly ping @remy
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
friendly ping @remy
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
friendly ping @remy
Just need to know where you want the code and I'd be happy to send a PR π
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
friendly ping @remy
Just need to know where you want the code and I'd be happy to send a PR π
Sorry, talk about having to prod me!
You had the solution a good while ago, but it was quicker for me to make the PR! I'll get it merged today.
Hehe, no worries, thanks for fixing this π
Would love to see a release with this in it π
I seem to have lost the PR I was planning to make. Good lord I'm distracted quickly!
:tada: This issue has been resolved in version 2.0.21 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 2.0.22 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
nodemon -v
: 2.0.20NODE_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 runNODE_OPTIONS='--loader @esbuild-kit/esm-loader' node src/server.ts
(same command but withnode
instead ofnodemon
).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 usedts-node
to transpile the typescript files.Steps to reproduce
package.json
filenpm install
Create the following
index.ts
file:NODE_OPTIONS='--loader @esbuild-kit/esm-loader' node index.ts
NODE_OPTIONS='--loader @esbuild-kit/esm-loader' nodemon index.ts