brunch / commonjs-require-definition

Common.js require definition.
MIT License
13 stars 12 forks source link

The implement of `require.register` function has some problem #30

Open zhengxiaoyao0716 opened 6 years ago

zhengxiaoyao0716 commented 6 years ago

From https://github.com/brunch/brunch/issues/1771

zhengxiaoyao0716 commented 6 years ago

Well, I took a look for those source, it, emm, a bit ugly. Why we keep such a large size map named aliases? it useless. What we need is just expand an suffix if user not given. so we just need to keep an ordered list of commonly suffix, and provide a new interface to allow plugin developer control them. Then, tried those suffix in turn in expandAlias function, that what NodeJS done .