Skip to content
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

using symbolic links inside node_modules #1064

Closed
mvolkmann opened this issue Oct 14, 2016 · 2 comments
Closed

using symbolic links inside node_modules #1064

mvolkmann opened this issue Oct 14, 2016 · 2 comments

Comments

@mvolkmann
Copy link

This is perhaps a request for documentation. Are there reasons why it would be a bad idea for yarn to populate the node_modules directory of a project with symbolic links to package directories under ~/.yarn.cache rather than copying those directories? Obviously that would save a lot of disk space.

@dmi3y
Copy link

dmi3y commented Oct 14, 2016

I believe that yarn link could be one of these reasons... although it seems to be workable anyways. And if implementation would be explicitly optional, I think I it makes sense. Something like yarn install --symlinked or something...

Big danger here, what if dev modified one of the linked module, that would effectively blew up any other project that is using this module. Integrity checks might help, that's seems that yarn doing it already?

@Daniel15
Copy link
Member

The main issue with symlinks is that if you delete the cache, your app will no longer work (as the symlink points to the cache). Hardlinks would solve this while still retaining the disk space advantages. Symlinks are essentially a pointer to another file path (so reading the symlink requires reading the file path it points to), while hardlinks result in multiple files pointing to the exact same data in the filesystem (so the file can be read directly). There's an existing issue about using hardlinks here: #499

The other main issue is that if someone modifies a file in node_modules, they may not realise that it actually modifies the file everywhere, not just in the local copy.

I agree that it would be a great optional feature though. I'd use it!

I'm going to close this out and we can follow up in #499. Thanks for using Yarn! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants