sindresorhus / import-local

Let a globally installed package use a locally installed version of itself if available
MIT License
154 stars 11 forks source link

Fix handling of different partitions on Windows #12

Closed yingning2021 closed 3 years ago

yingning2021 commented 3 years ago

description: In windows, if localNodeModules and filename is in different partition, path.relative will return the value of filename. then filenameInLocalNodeModules will be true. It is fault. solved: In this case, the first char of localNodeModules and filename will be different. adding a condition make filenameInLocalNodeModules In unix, the new condition will always be true, don't break the logic before.

sindresorhus commented 3 years ago

It would be better to compare path.parse(…).root.

And the logic needs a short code comment.