unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
383 stars 20 forks source link

fix: order aliases from specific to general #45

Closed danielroe closed 2 years ago

danielroe commented 2 years ago

Currently aliases are resolved from top down, so stream/web is (for example) resolved as unenv/runtime/node/stream/index/web rather than unenv/runtime/node/stream/web/index.

This PR reorders aliases so the more specific ones are at the top. Alternatively, we could use a helper function to do this for us.

https://github.com/unjs/nitro/issues/378

pi0 commented 2 years ago

We might normalize and sort them in env.ts#L18 once when generating preset.