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
It appears that when PnP is enabled, Yarn's ESM loader doesn't support subpath imports correctly (i.e. imports that start with # in a package with an imports map in its package.json file). It looks like Yarn thinks it's a package instead, which then fails to be imported because it's not listed in that package's dependencies.
To reproduce
$ yarn init -2
$ yarn set version 3.2.3
$ yarn config set pnpEnableEsmLoader true
$ yarn add aws-jwt-verify@3.1.0
$ echo 'import "aws-jwt-verify"' > in.mjs
$ yarn node in.mjs
.pnp.cjs:8466
return Object.defineProperties(new Error(message), {
^
Error: aws-jwt-verify tried to access #node-web-compat, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: #node-web-compat (via "#node-web-compat/package.json")
Required by: aws-jwt-verify@npm:3.1.0 (via .yarn/cache/aws-jwt-verify-npm-3.1.0-1694314cd9-b978817018.zip/node_modules/aws-jwt-verify/dist/esm/jwt-rsa.js)
at makeError (.pnp.cjs:8466:34)
at resolveToUnqualified (.pnp.cjs:9385:21)
at Object.resolveToUnqualified (.pnp.cjs:9529:26)
at resolve$1 (.pnp.loader.mjs:224:31)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
at link (node:internal/modules/esm/module_job:78:36)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Someone filed an issue about this package not working with esbuild's implementation of PnP: evanw/esbuild#2545. But Yarn itself doesn't work with this package either. I'm guessing this is a bug with Yarn.
The text was updated successfully, but these errors were encountered:
Self-service
Describe the bug
It appears that when PnP is enabled, Yarn's ESM loader doesn't support subpath imports correctly (i.e. imports that start with
#
in a package with animports
map in itspackage.json
file). It looks like Yarn thinks it's a package instead, which then fails to be imported because it's not listed in that package's dependencies.To reproduce
Environment
System: OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa) CPU: (2) x64 DO-Regular Binaries: Node: 16.14.0 - /tmp/xfs-e3802538/node Yarn: 3.2.3 - /tmp/xfs-e3802538/yarn npm: 8.7.0 - ~/node/bin/npm
Additional context
Someone filed an issue about this package not working with esbuild's implementation of PnP: evanw/esbuild#2545. But Yarn itself doesn't work with this package either. I'm guessing this is a bug with Yarn.
The text was updated successfully, but these errors were encountered: