terpiljenya / import-glob

ES6 import with glob patterns (preloader for Webpack)
57 stars 28 forks source link

Add module object with reference to imported filename #12

Open thewillk opened 6 years ago

thewillk commented 6 years ago

In order to keep track of the file name that the module imports from, I have added a xxxByPath variable that contains a map from the filename to the corresponding module.

This is "non-breaking" in that this variable is unlikely to be used by anyone.

A better solution (which is quite breaking and not implemented here) would be to only output the new variable, since it can be used to generate the current array via Object.values(moduleObject). That way only the variable name the user specified would be used.