Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor all internal module imports to use fully-specified paths (wi…
…th extensions) - use the '.js' (*not* '.ts') extension to force correct fully specified `tsc` output # Discussion Browsers/ESM/Deno require fully specified import paths/URLs and don't perform any extension substitution "magic" when searching for the import file. `tsc` does not and will likely *never* change the emitted JS code [^1], including rewriting import paths/URLs. So, the for `tsc` compilation to produce working code these targets, a fully specified path/URL must be used in the '.ts' source code. As of TypeScript 2.0, import paths using the '.js' extension as a replacement for '.ts' are resolved correctly in the compiled code [^2]. The `rollup` bundler is also noted to support the same construction [^3]. So, the most compatible way construction is to use fully specified import paths which replace the trailing '.ts' with '.js'. Odd, yes, but it's the best working practice. # refs [1]: microsoft/TypeScript#16577 (comment) [2]: microsoft/TypeScript#16577 (comment) [3]: microsoft/TypeScript#16577 (comment)
- Loading branch information