You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow custom file extensions in --eval from CLI #2135
As part of a prebuild step in a project of mine, I'm reading multiple tsx files, inserting a small snippet, and running them through ts-node --eval. I would like this to run if I specify an appropriate file extension.
Is this request related to a problem?
In the above case, even if I pass the appropriate config, due to the file name in eval being hardcoded as [eval].ts, it ends up evaluated as .ts.
npx ts-node --swc --compilerOptions '{"jsx":"react-jsx"}' -e 'const element = <div>You lost the game</div>;'
With the addition of a flag like --eval-extension '.tsx', the above could now work:
npx ts-node --swc --compilerOptions '{"jsx":"react-jsx"}' --eval-extension '.tsx' -e 'const element = <div>You lost the game</div>;'
Alternatives you've considered
Currently I'm adding an additional step to the process, where I pipe the output to an intermediate file and then interpret it through ts-node, but this is a bypass for an apparent shortcoming of the -e flag.
Activity