Description
Node.js does not expose any public API for resolving dependencies. As a result, there are many packages in the ecosystem that are trying to reimplement/mimic Node's module resolution algorithm.
resolve, resolve-from, eslint-plugin-import... just to list some of them.
The big problem with these implementations is that they don't work the way Node's require.resolve
works. For instance, both resolve
and resolve-from
were preserving symlinks by default. I did PRs to both packages to fix this issue but they are just a drop in the ocean.
I work on pnpm - a Node package manager that uses a symlinked node_modules structure. This node_modules structure is Node.js-compatible (when Node is executed w/o the --preserve-symlinks flag) but because of the many incorrect implementations of Node's module resolution algorithm, pnpm is basically unusable with most of the popular frameworks/toolings.
Exposing Node's resolution algorithm would allow experimenting with different node_modules structures and tools/frameworks would adjust because they would resolve dependencies correctly.