35 ms·
The file system layout is constrained by how dependency resolution works. For example, a require() call has a very (computationally) simple algorithm. I certai
by JaRail 11y ago
The file system layout is constrained by how dependency resolution works. For example, a require() call has a very (computationally) simple algorithm.
I certainly agree that your suggestion simplifies file-system layouts. The tradeoff is that the complexity shifts to other parts of the system.
That said, I'm not a fan of the v3 approach. I'd have preferred a central package cache with a structure similar to your suggestion. I'd add that each package in the cache should have all of its dependencies resolved in its own /node_modules/ dir with symlinks. Unfortunately, I still can't see a nice way to handle peer dependencies. Peer dependencies require the ability to walk up the file system to resolve, which you can't do with symlinks.