continuation of #837, #529, #648
ts-node has one quite confusing, but quite explainable issue - it adds .ts to the resolve.extensions. However - adds to the end, which breaks code user expectations about how file resolving should work.
So - how it should work
js should be preferred over ts when preferTsExts is not set.
ts should be preferred over js when preferTsExts is set.
- 😅
ts and js should be preferred over css and less.
How it works
However - the current logic adds ts or after everything, or before everything.
While - should do it relative to js position - just after jsx?, or just before.
The problem
preferTsExts is still not documented, and, honestly, should not be documented. It shall work out of the box. 5 months ago, when I run into the issue, I've resolved it by manually hoisting extensions, hopefully, it's now supported out of the box.
But the problem is not closed unless default behavior is broken.
What would you say about changing this moment? js and ts should be in one "group", so let's make it a bit more "smart".
ts-node has one quite confusing, but quite explainable issue - it adds
.tsto theresolve.extensions. However - adds to the end, which breaks code user expectations about how file resolving should work.So - how it should work
jsshould be preferred overtswhenpreferTsExtsis not set.tsshould be preferred overjswhenpreferTsExtsis set.tsandjsshould be preferred overcssandless.How it works
However - the current logic adds
tsor after everything, or before everything.While - should do it relative to
jsposition - just afterjsx?, or just before.The problem
preferTsExtsis still not documented, and, honestly, should not be documented. It shall work out of the box. 5 months ago, when I run into the issue, I've resolved it by manually hoisting extensions, hopefully, it's now supported out of the box.But the problem is not closed unless default behavior is broken.
What would you say about changing this moment?
jsandtsshould be in one "group", so let's make it a bit more "smart".