Yarn@Berry support
See original GitHub issue- I’ve read the guidelines for Contributing to Roots Projects
- This request isn’t a duplicate of an existing issue
- I’ve read the docs and followed them (if applicable)
- This is not a personal support request that should be posted on the Roots Discourse community
Description
[Description of the issue] Using bud in a project that uses Yarn@Berry don’t work. I received error:
(node:23777) [ERR_REQUIRE_ESM] Error Plugin: @roots/bud [ERR_REQUIRE_ESM]: Must use import to load ES Module: /{FOLDER_ROOT}/node_modules/@roots/bud/node_modules/globby/index.js
require() of ES modules is not supported.
require() of /{FOLDER_ROOT}/node_modules/@roots/bud/node_modules/globby/index.js from /{FOLDER_ROOT}/node_modules/@oclif/config/lib/plugin.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /{FOLDER_ROOT}/node_modules/@roots/bud/node_modules/globby/package.json.
I found out, that Yarn@Berry installs @roots/bud dependencies in it’s folder and so there is a globby there. When I just use normal Yarn everything works.
Steps to reproduce
- Init simple project with
npm init - Change
yarn:yarn set version berry - Install
bud:yarn add @roots/bud @roots/bud-cli --dev - run
yarn bud init
Expected behavior: Should not crash
Actual behavior:
Crashes bud
Reproduces how often: [What percentage of the time does it reproduce?] everytime
Versions
@roots/bud: ^4.7.0-10
@roots/bud-cli: ^4.7.0-10
macOS 11.3.1 Yarn: 1.22.11 Yarn Berry: 3.0.1 Node: 14.17.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
yarnpkg/berry: Active development trunk for Yarn - GitHub
Yarn supports Node by default but isn't limited to it - plugins can add support for other languages; Yarn supports workspaces natively, and...
Read more >Support for Yarn 3 - Depfu Blog
We've now launched support for Yarn Berry and the important bit here is that we only support v3 and not v2. Yarn 3...
Read more >Plug'n'Play | Yarn - Package Manager
Native support; Support via plugins; Incompatible. Frequently Asked Questions. Why not use import maps? Packages are stored inside Zip archives: How can I ......
Read more >Advanced package manager features for npm, Yarn, and pnpm
Debugging issues with dependencies in Yarn Berry PnP. To debug issues with dependencies, you need additional tool support (e.g., ...
Read more >Problems with Intellisense with Yarn (berry) 2 PnP and ...
Questions in bold. Webstorm (tried 2020.2.2 and 2020.2.3RC) on Windows 10 x64 Webstorm should support Yarn 2 and PnP since 2019.3+ Is it......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@kellymears This issue is still there with the latest 5.0.0-next19. Adding the
resolutionsfixes this in 5.0 as well.I’m closing this issue in favor of #941, which should address the underlying cause. This isn’t a problem with yarn. This is a problem with modern JS 🥲