Open timfish opened 5 months ago
@privatenumber This would also solve the fundamental problem that I flagged in the other thread – about making open-telemetry work with tsx.
I guess if the order was swapped it would mean that --import
files could not be TypeScript because the loader wouldn't be registered yet.
I suspect the one solution might be to put the TypeScript imports after the tsx loaders and everything else before? Or maybe add another option --import-first
which get added first?
I can +1 on this one. I need my loaders to come last, and can't make it because tsx imports via subprocessing.
Acknowledgements
Minimal reproduction URL
Below
Problem & expected behavior (under 200 words)
There were previous issues with
import-in-the-middle
which are now fixed. The issue now is thatimport-in-the-middle
cannot parse TypeScript and there's no way to get the loaders in the correct ordertest.ts
another.ts
Results in an error because
import-in-the-middle
cannot parse TypeScript:Looking at the stack before this occurs we can see that the loaders are ordered as follows, which means that the
tsx
loader is trying to fetch TypeScript code through the iitm loader:tsx > iitm > default
This is because of the following code which means that
--import
and--loader
args are always registered aftertsx
own loader: https://github.com/privatenumber/tsx/blob/aa2b639a9bac8ae28a46b847013fda7f5cd4466b/src/run.ts#L36-L46Bugs are expected to be fixed by those affected by it
Compensating engineering work financially will speed up resolution