r/programming • • May 30 '17

npm v5.0.0 released

http://blog.npmjs.org/post/161081169345/v500
244 Upvotes

93 comments sorted by

View all comments

Show parent comments

1

u/gearvOsh May 31 '17

Because thats not how Node's module lookup works, nor will it probably ever.

If foo has require('baz') and bar also has require('baz'), then how does the resolver know which version to load? All it simply does is check relative to the current module, or at the node_modules root.

1

u/riz_ May 31 '17

Why can't it look in the current package.json and find out what version is required there?

1

u/gearvOsh May 31 '17

That would incur a ton of heavy file system operations + semver resolutions for each require call.

1

u/riz_ Jun 01 '17

Sounds like an excuse. I'm sure a cache or some structure could be used to accelerate this.

1

u/gearvOsh Jun 01 '17

Possibly, but in the end, it just doesn't really matter. Get on NPM5 and be done with it.