Import wildcards on the right side of the statement

Alican Çubukçuoğlu alicancubukcuoglu at gmail.com
Thu Apr 21 16:38:29 UTC 2016


I think `import` should be as dumb as possible and you should look for
another way to do this and it is probably [WHATWG Loader](
https://github.com/whatwg/loader).

Another problem is that you are supposed to point to a single module when
you `import` and you point to multiple modules when you glob. How do these
multiple modules get merged into one?

If making an "index.js" for your "features" directory is such a trouble,
then investigate the WHATWG Loader spec to see if it allows you to:

1- Intercept an import and get its path.

2- If the path contains a glob, load multiple modules and merge them.

3- Provide the merged module as the result of the import.

Of course, you still won't be able to glob in a browser. For that, you can
glob when you build your app and ship it with the results.

To be honest, just keep an index manually.

Here is another [example](
https://gist.github.com/AlicanC/9b8c12a49a3fc3382f0d3a134b2e491a) anyways.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160421/2c32f209/attachment.html>


More information about the es-discuss mailing list