tapjs/tsimp

Cannot import typescript-only dependencies

Opened this issue · 3 comments

While this package does a good job within the project it's invoked from, if you are in a mono-repo and import a sibling package that is Typescript-only then it doesn't work.

I get the TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for ... error for the dependency import because its src/index.ts has a TS extension.

I'm using tsimp through its own CLI, like tsimp ./bin/my-stack.ts

Have the same issue.
With tsimp, I cannot import '.ts' file from the parent folder of the sub-project.
Compilation with tsc works ok.

Does it work if you use the node importer instead?

node --import=tsimp/import ./bin/my-stack.ts

Same issue, happens to me both when using tsimp directly and when using the node importer, while tsc compiles with no problem. Had to switch to tsx for this reason.