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

feat(pnp): enable ESM support by default #5574

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Jul 10, 2023

What's the problem this PR addresses?

Some projects and their dependencies require ESM support but Yarn is unable to detect it.

Fixes https://github.com/yarnpkg/berry/actions/runs/5505562368/jobs/10033080416#step:4:56

Error: ENOTDIR: not a directory, stat '/home/runner/.yarn/berry/cache/prettier-npm-3.0.0-7ffbcce680-10c0.zip/node_modules/prettier/internal/cli.mjs'
    at statSync (node:fs:1615:3)
    at tryStatSync (node:internal/modules/esm/resolve:176:13)
    at finalizeResolution (node:internal/modules/esm/resolve:316:17)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1188:29) {
  errno: -20,
  syscall: 'stat',
  code: 'ENOTDIR',
  path: '/home/runner/.yarn/berry/cache/prettier-npm-3.0.0-7ffbcce680-10c0.zip/node_modules/prettier/internal/cli.mjs'
}

How did you fix it?

Removed the auto-detection and enabled ESM support by default.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis
Copy link
Member

arcanis commented Jul 18, 2023

Are there any chance that this could break something unexpectedly? Perhaps it'd be safer to whitelist Prettier for the time being, and revisit in a patch or minor if it evolves into a common bug ?

@merceyz
Copy link
Member Author

merceyz commented Jul 21, 2023

It might but we've been testing it since #2161 so hopefully it doesn't.

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 this pull request may close these issues.

None yet

2 participants