ilearnio / module-alias

Register aliases of directories and custom module paths in Node
MIT License
1.76k stars 69 forks source link

Resolves #13. Now resolves the longest alias match #14

Closed thomas-p-wilson closed 7 years ago

thomas-p-wilson commented 7 years ago

Given aliases such as:

"react-dom": "preact-compat-enzyme",
"react-dom/server": "preact-render-to-string",

Previously, if one attempted require('react-dom/server'), the library would accept react-dom as the appropriate alias to use. This PR resolves that by sorting the alias names and then traversing that list to look for the longest match.

thomas-p-wilson commented 7 years ago

No worries! Glad to help!

On Jul 28, 2017 5:37 AM, "Nick Gavrilov" notifications@github.com wrote:

@ilearnio approved this pull request.

Hey. Thanks for your work! I really appreciate it

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ilearnio/module-alias/pull/14#pullrequestreview-52886395, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkeu40N-JS6XX7CcgAbPkMh0NzpMadHks5sSavngaJpZM4Ohl7Z .