Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Support Yarn Plug'n'Play #3047

Closed
Kurt-von-Laven opened this issue Jun 5, 2022 · 4 comments
Closed

Support Yarn Plug'n'Play #3047

Kurt-von-Laven opened this issue Jun 5, 2022 · 4 comments
Labels

Comments

@Kurt-von-Laven
Copy link

I am stumped trying to run AVA on Yarn PnP and wondering how feasible it currently is, whether there may be some insight I missed, or how I might go about adding native support for PnP to AVA. I ran into chalk/chalk#531 and worked around it as described on that thread. That got AVA to load, but it crashes on the first import.

In PnP, most Node.js commands work by running yarn <command>, which pretty much just runs node --require "$(pwd)/.pnp.cjs" <command>. See the excerpt from Yarn's documentation below for a brief discussion of the purpose of .pnp.cjs. Hence, I tried passing --require=./.pnp.cjs via AVA's nodeArguments config option, but encountered the same crash as above on the first import.

The .pnp.cjs file contains various maps: one linking package names and versions to their location on the disk and another one linking package names and versions to their list of dependencies. With these lookup tables, Yarn can instantly tell Node where to find any package it needs to access, as long as they are part of the dependency tree, and as long as this file is loaded within your environment (more on that in the next section). ~ Fixing node_modules

@novemberborn
Copy link
Member

AVA follows the module system as defined by Node.js — it's up to Yarn to not break that.

@novemberborn novemberborn closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2022
@Kurt-von-Laven
Copy link
Author

A fix for yarnpkg/berry#3843 was just merged, so anyone following this issue may want to try running AVA on the latest Yarn PnP once it's released.

@mrienstra
Copy link

A fix for yarnpkg/berry#3843 was just merged, so anyone following this issue may want to try running AVA on the latest Yarn PnP once it's released.

The fix is available in 4.0.0-rc.22. Run yarn set version canary if you want to try it. v4 release is still a little ways off ("may take a couple more months"), but:

[...] what's in master is stable, and I'd recommend you to try it. The only notable difference with stable is that we reserve the right to land a couple more breaking changes in future RCs, but in terms of stability it's almost always better to use RCs than stable.

... according to yarnpkg/berry#4895

See yarnpkg/berry#3591 for v4 breaking changes. I've seen two mentions of people stumbling over enableGlobalCache default changing from false to true. (Google search: site:yarnpkg.com "enableGlobalCache")

@mrienstra
Copy link

Update: the fix that adds support for the package.json includes field is also in the Yarn 3.2.4 release.

@avajs avajs locked and limited conversation to collaborators Nov 1, 2022
@novemberborn novemberborn converted this issue into discussion #3132 Nov 1, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants