-
Fix Yarn PnP issue with packages containing
index.js
(#2455, #2461)Yarn PnP's tests require the resolved paths to end in
/
. That's not how the rest of esbuild's internals work, however, and doing this messed up esbuild's node module path resolution regarding automatically-detectedindex.js
files. Previously packages that relied on implicitindex.js
resolution rules didn't work with esbuild under Yarn PnP. Removing this slash has fixed esbuild's path resolution behavior regardingindex.js
, which should now the same both with and without Yarn PnP. -
Fix Yarn PnP support for
extends
intsconfig.json
(#2456)Previously using
extends
intsconfig.json
with a path in a Yarn PnP package didn't work. This is because the process of setting up package path resolution rules requires parsingtsconfig.json
files (due to thebaseUrl
andpaths
features) and resolvingextends
to a package path requires package path resolution rules to already be set up, which is a circular dependency. This cycle is broken by using special rules forextends
intsconfig.json
that bypasses esbuild's normal package path resolution process. This is why usingextends
with a Yarn PnP package didn't automatically work. With this release, these special rules have been modified to check for a Yarn PnP manifest so this case should work now. -
Fix Yarn PnP support in
esbuild-wasm
(#2458)When running esbuild via WebAssembly, Yarn PnP support previously failed because Go's file system internals return
EINVAL
when trying to read a.zip
file as a directory when run with WebAssembly. This was unexpected because Go's file system internals returnENOTDIR
for this case on native. This release updates esbuild to treatEINVAL
likeENOTDIR
in this case, which fixes usingesbuild-wasm
to bundle a Yarn PnP project.Note that to be able to use
esbuild-wasm
for Yarn PnP successfully, you currently have to run it usingnode
instead ofyarn node
. This is because the file system shim that Yarn overwrites node's native file system API with currently generates invalid file descriptors with negative values when inside a.zip
file. This prevents esbuild from working correctly because Go's file system internals don't expect syscalls that succeed without an error to return an invalid file descriptor. Yarn is working on fixing their use of invalid file descriptors.