You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6a69a18 introduced a regression that prevents esbuild from resolving workspaces.
✘ [ERROR] Could not resolve "foo"
index.js:1:7:
1 │ import 'foo'
│ ~~~~~
╵ "./foo"
Use the relative path "./foo" to reference the file "foo/index.js". Without the leading "./", the
path "foo" is being interpreted as a package path instead.
1 error
node:child_process:866
throw err;
^
Error: Command failed: /tmp/tmp.d9yLfGFMsp/.yarn/unplugged/esbuild-npm-0.15.4-228a903ba9/node_modules/esbuild/lib/pnpapi-esbuild-linux-64-esbuild --bundle ./index.js
at checkExecSyncError (node:child_process:828:11)
at Object.execFileSync (node:child_process:863:15)
at Object.<anonymous> (/tmp/tmp.d9yLfGFMsp/.yarn/unplugged/esbuild-npm-0.15.4-228a903ba9/node_modules/esbuild/bin/esbuild:177:28)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require$$0.Module._extensions..js (/tmp/tmp.d9yLfGFMsp/.pnp.cjs:8990:33)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.require$$0.Module._load (/tmp/tmp.d9yLfGFMsp/.pnp.cjs:8830:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 564,
stdout: null,
stderr: null
}
In case you're curious, my fix for this issue looks something like this:
Modify RESOLVE_TO_UNQUALIFIED to return path.resolve(manifest.dirPath, dependencyPkg.packageLocation) and modulePath separately, with the result of path.resolve stored in pkgDirPath
Set absModulePath to path.join(pkgDirPath, modulePath)
Check for package.json in pkgDirPath
If package.json was found and the exports field exists
Run PACKAGE_EXPORTS_RESOLVE(pkgDirPath, modulePath, pjson.exports, defaultConditions) from node's specification
If package.json was found and the browser field exists
Interpret the browser mapping on the result of absModulePath (since esbuild is a bundler)
Try running LOAD_AS_FILE(absModulePath) from node's specification
Try running LOAD_AS_DIRECTORY(absModulePath) from node's specification
Describe the bug
6a69a18 introduced a regression that prevents esbuild from resolving workspaces.
Ref yarnpkg/berry#4732
Ref #2473 (comment)
To Reproduce
The text was updated successfully, but these errors were encountered: