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
Given ts-node already reads tsconfig.json, it should be able to figure out a mapping from source file -> target file. By checking the timestamp of both file, we should be able to know whether the target file is up-to-date and smartly just import that file instead of taking time to compile TS file.
There might be certain level of uncertain in some setup, so considering making it an option seems a reasonable choice.
Alternatively, if ts-node can detect a tsc (or tsc watch) running and wait for it to finish, seems like another good option.
Is this request related to a problem?
I want to run ts-node as my entrypoint to everything including the server and scripts, but typically it's slower than just running node on the transpiled JS (if there's one). I also want to keep the possibility if tsc watch is not running or the transpiled JS is outdated, ts-node will just "smartly" choose to compile TS file and import.
Alternatives you've considered
Doing the detection myself
Detect whether a tsc-watch is running
Additional context
The text was updated successfully, but these errors were encountered:
@zen0wu in general, any ideas that make ts-node faster are great, and I'm a fan. However, for this request, we'll need a clearer picture of the implementation. Here are a few bullet points to spur discussion:
How do we detect a tsc-watch? Is this possible and practical?
It is possible that changes to bar.ts affect the emit of foo.ts, even if foo.ts did not change. How do we deal with that?
Are there guarantees around the mtime of tsbuildinfo? Can it be used to figure out if files have been compiled?
When using transpile-only things get way simpler. We have a ticket to re-add caching, see Restore cache functionality (default to off) #951. Is it more practical and simpler for someone to implement that feature?
Someone will need to figure out a more detailed proposal, with answers to the questions above, before we can consider adding a feature like this.
Closing because I doubt we'll receive a PR for this, and the complexity is too high.
Users can always precompile and run the compiled output directly if they want, using ts-node or vanilla node, either should work, since ts-node is happy to run precompiled stuff.
Possibly related: #1845
Another related idea: outDir -> rootDir mapping #1514
Desired Behavior
Given ts-node already reads
tsconfig.json
, it should be able to figure out a mapping from source file -> target file. By checking the timestamp of both file, we should be able to know whether the target file is up-to-date and smartly just import that file instead of taking time to compile TS file.There might be certain level of uncertain in some setup, so considering making it an option seems a reasonable choice.
Alternatively, if ts-node can detect a tsc (or tsc watch) running and wait for it to finish, seems like another good option.
Is this request related to a problem?
I want to run
ts-node
as my entrypoint to everything including the server and scripts, but typically it's slower than just runningnode
on the transpiled JS (if there's one). I also want to keep the possibility iftsc watch
is not running or the transpiled JS is outdated, ts-node will just "smartly" choose to compile TS file and import.Alternatives you've considered
tsc-watch
is runningAdditional context
The text was updated successfully, but these errors were encountered: