#4030·berry

[Feature] allow packageLocations in .pnp.cjs to be absolute paths

Author: adrian-gierakowskiCreated Jan 28, 2022Updated Sep 14, 2026
Labelsenhancement
  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

As a NixOS package maintainer or a developer wanting to package node applications using yarn berry with nix, I'd like to be able to reference packages stored in the /nix/store using absolute paths, instead of relative. Currently paths starting with / are resolved as relative to the project (not sure if this is intended, it could be a bug?)

Describe the solution you'd like

Detect when path start with / and treat the path as absolute, instead of relative.

Describe the drawbacks of your solution

existing code/projects might depend on current behaviour

Describe alternatives you've considered

I can resolve the paths to relative ones, and as long as the .pnp.cjs remains at it's original location in /nix/store things will work just fine. However this adds an extra step to the build process and makes it impossible to simply copy .pnp.cjs to a different location (relatively to /nix/store) and use it from there.