Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore type-only entries in paths TypeScript compiler option #2074

Closed
shroudedcode opened this issue Mar 2, 2022 · 1 comment · Fixed by #2075
Closed

Ignore type-only entries in paths TypeScript compiler option #2074

shroudedcode opened this issue Mar 2, 2022 · 1 comment · Fixed by #2075

Comments

@shroudedcode
Copy link

Based on #2070 (comment)

Currently, ESBuild uses TypeScript's paths compiler option to resolve source files which can lead to problems if the said option is only used to fix typing-related issues. That's because in those cases the destination paths will be .d.ts files which either result in parsing issues or the package not being imported (because the file is handled like an empty file).

Reproduction

The issue can be reproduced by cloning this repo, installing the dependencies, and then running the bundle and bundle:paths scripts. Right now the latter will fail because this fix isn't released yet. Once it is released it will no longer fail, but produce incorrect output as the bundle will no longer include the imported package (just void 0).

Possible fix

This could be fixed by ignoring all types entries ending in .d.ts as developers will never expect those to actually resolve to a source file at build time.

/cc @magic-akari

@magic-akari
Copy link
Contributor

I am willing to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants