Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Injects the PnP runtime in the process before requiring the user conf…
…ig (#5954) **What's the problem this PR addresses?** We added support for JS constraints thanks to the `yarn.config.cjs` file. However this file is currently executed from within the Yarn process, so it doesn't have access to the dependencies when operating under the PnP installation mode. Fixes #5878 **How did you fix it?** I'm still on the fence on the right solution. This PR automatically loads the `.pnp.cjs` file when the `loadUserConfig` file is called. An alternative would be a post-install hook to allow each linker to inject their runtime inside the process post-install, but that was more involved and I figured it's worth more consideration. Another alternative was to not do anything and expect users to setup the PnP runtime themselves, but it feels something that Yarn should be able to handle. A third alternative would be to evaluate this file within a worker thread, which would be started with the proper `execArgv` flags. It's less intrusive than the post-install hook so I kinda like this idea, but again - worth more consideration. I'm working on enabling tests, and to this effect I'm checking whether we can remove the `NODE_OPTIONS` values from the `makeTemporaryEnv` subprocesses. **Checklist** <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
- Loading branch information