jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.26k stars 508 forks source link

Allow import with .ts / .tsx endings (include extension) for Deno support #740

Closed eirikb closed 4 years ago

eirikb commented 4 years ago

Current Behavior

import a from './a.ts';

results in:

semantic error TS2691: An import path cannot end with a '.ts' extension. Consider importing './a' instead.

Desired Behavior

Import should just work as if this was used:

import a from './a';

Who does this impact? Who is this for?

Users aiming to build with tsdx for npm but still support Deno.
My library doesn't use any of the Node API, or have any dependencies, so my source code would "just work" in Deno with this fix.

agilgur5 commented 4 years ago

This is a TypeScript error, not a TSDX error; even if tsdx build were to support that, it would break various other tooling in the ecosystem that relies on TS (including probably test, lint, tsc --noEmit, etc). We've already had issues with incompatibilities that are very confusing for users, so I don't think we want to add to those.

In https://github.com/jaredpalmer/tsdx/issues/722#issuecomment-633120045, I mentioned why it would be better to use the transpiled JS and have a Deno build option instead (tl;dr Deno has its own tsconfig settings and still compiles your code). I guess this is another thing Deno is incompatible with in the existing ecosystem that is limiting its own adoption.