You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
pnpm is a mature package manager used by a significant amount of companies and it works well with almost all stacks in the ecosystem. However, because the node_modules structure created by pnpm heavily relies on symlinks, pnpm is unusable in environments that do not support symlinks:
pnpm doesn't work with electron apps
an app that uses pnpm cannot be deployed to lambda
These issues of symlinks are probably the main reason neither npm nor Yarn considered to create a properly nested node_modules using symlinks.
Describe the solution you'd like
Some way to link a package from a different location using a file, not a symlink. For instance, node_modules/foo can be a text file that contains a relative path to a different location. When require('foo') is searching for the location of foo, the path from the text file is read and used to track down the reallocation of foo (in case of pnpm it will be something like .pnpm/foo@1.0.0/node_modules/foo)
Describe alternatives you've considered
I considered Yarn Plug'n'Play. pnpm supports Yarn PnP, there's an option that makes pnpm create and use a pnp generated via one of Yarn's packages. I like the concept of Plug'n'Play but it still has many issues. Even more issues than symlinks.
I think Plug'n'Play would be a good solution if Node.js would natively support providing some import maps. pnpm would then generate such import maps and node would read the files directly from pnpm's content-addressable store.
I also considered creating dummy redirect files. Instead of creating a symlink, we can create something like node_modules/foo/index.js:
However, this would not cover cases like require('foo/lib/something')
I also considered replacing the contents of all require/import statements during installation. So if a package is installed, which requires foo, pnpm replaces require('foo') with the reallocation of foo (require('../../foo@1.0.0/node_modules/foo')) in all files.
This solution would probably work in most cases but it would require a lot of new logic to be added to pnpm.
Also, it would only work in copy mode, and that would destroy all the great disk saving benefits of pnpm.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
pnpm is a mature package manager used by a significant amount of companies and it works well with almost all stacks in the ecosystem. However, because the node_modules structure created by pnpm heavily relies on symlinks, pnpm is unusable in environments that do not support symlinks:
These issues of symlinks are probably the main reason neither npm nor Yarn considered to create a properly nested node_modules using symlinks.
Describe the solution you'd like
Some way to link a package from a different location using a file, not a symlink. For instance,
node_modules/foo
can be a text file that contains a relative path to a different location. Whenrequire('foo')
is searching for the location of foo, the path from the text file is read and used to track down the reallocation of foo (in case of pnpm it will be something like.pnpm/foo@1.0.0/node_modules/foo
)Describe alternatives you've considered
I considered Yarn Plug'n'Play. pnpm supports Yarn PnP, there's an option that makes pnpm create and use a pnp generated via one of Yarn's packages. I like the concept of Plug'n'Play but it still has many issues. Even more issues than symlinks.
I think Plug'n'Play would be a good solution if Node.js would natively support providing some import maps. pnpm would then generate such import maps and node would read the files directly from pnpm's content-addressable store.
I also considered creating dummy redirect files. Instead of creating a symlink, we can create something like
node_modules/foo/index.js
:However, this would not cover cases like
require('foo/lib/something')
I also considered replacing the contents of all require/import statements during installation. So if a package is installed, which requires
foo
, pnpm replacesrequire('foo')
with the reallocation of foo (require('../../foo@1.0.0/node_modules/foo')
) in all files.This solution would probably work in most cases but it would require a lot of new logic to be added to pnpm.
Also, it would only work in copy mode, and that would destroy all the great disk saving benefits of pnpm.
cc @shellscape @vjpr @ExE-Boss
Beta Was this translation helpful? Give feedback.
All reactions