SukkaW / nolyfill

Speed up your package installation process, reduce your disk usage, and extend the lifespan of your precious SSD.
MIT License
1.11k stars 15 forks source link

[Feature request] Replace `resolve` #71

Closed TheDevMinerTV closed 4 months ago

TheDevMinerTV commented 5 months ago

resolve is used by most bundlers and build tools, which causes it to get installed multiple times because of how npm in isolation mode works. I don't see the point in this library since it literally says it "implements Node's require.resolve()".

https://npm.anvaka.com/#/view/2d/resolve https://voldephobia.rschristian.dev/?q=resolve

valadaptive commented 5 months ago

This is a huge one. resolve is used in Jest and Babel, which are used in (as you said) pretty much every bundler.

Jest's rationale (https://github.com/jestjs/jest/pull/9520) is that it's faster than require.resolve() and can support custom filesystem hooks to further increase performance. Other users may be using it for similar customizability reasons (async support, etc).

The require.resolve algorithm is documented as pseudocode in Node's docs, and implemented as JS within Node itself.

SukkaW commented 5 months ago

This is a huge one. resolve is used in Jest and Babel, which are used in (as you said) pretty much every bundler. ... can support custom filesystem hooks to further increase performance.

Agreed, that's why I am hesitant about this.

https://npmgraph.js.org/?q=resolve

image

Also, the resolve looks OK, as the only toxic dependency (so far) is the is-core-module, which is discussed in #69.

SukkaW commented 4 months ago

Since nolyfill 1.0.32 introduces @nolyfill/is-core-module, I am going to close the issue for now.

And feel free to create a new issue or ping me to re-open this one if HE WHO MUST NOT BE NAMED introduces other toxic dependencies to the resolve!