-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
(PnP) modules in tsconfig.json#extends aren't properly resolved #2456
Comments
This is a Vite problem, not an esbuild problem. Vite doesn't use esbuild for bundling so it's impossible for esbuild's new PnP support to do anything here. Closing. |
As someone in the Vite issue thread pointed out, the config file is bundled directly using esbuild.build: https://github.com/vitejs/vite/blob/e53c029ef645d1d91c284799489a11d1f41303ec/packages/vite/src/node/config.ts#L934 (and PnP support in esbuild 0.15 does have an effect, when specifying the resolved path esbuild 0.14 still fails because it can't read the zip archive but 0.15 handles it no problem) But you're right, I should maybe try to create a minimal repro independent from Vite 😅 |
Seems like it would be possible If esbuild were to use the same resolution mechanism for tsconfig's extend field (according to the docs the path there may use Node.js style resolution). |
Sorry, my mistake. I did not realize Vite was using esbuild as a bundler like this. |
The problem here is that package path resolution depends on |
Is it everyone using PnP or just everyone? If it's the former, then I guess performance overhead is better that not working 🧐 |
Everyone, since esbuild will have to search for PnP manifests to see if they exist. This will also be in the serial part of the build before most of the parallelism kicks in because package path resolution is still being set up. |
Would an opt-in via an option be better? And perhaps ESBuild's NPM wrapper could check for Yarn's PnP register/loader in UPD: or check for |
This is not true for esbuild since esbuild is written in native code instead of JavaScript. Requiring this would be a huge performance penalty because Yarn is very slow to start up, so I'm not going to do this.
I'm just going to implement this for everyone. The performance cost probably isn't big. |
Now that esbuild supports PnP, extending a
tsconfig
from an installed package should work and this issue should be fixed: vitejs/vite#8357However, it doesn't quite work yet. If you manually resolve the path using
require.resolve
and then set the resolved virtual path as"extends"
, everything is fine and the JSON is read from its zip archive:But with a bare module specifier,
esbuild
fails to load thetsconfig.json
and prints a warning.So I assume somewhere a resolve step is missing?
The text was updated successfully, but these errors were encountered: