Re: [w3c/webcomponents] HTML Modules (#645)

@Jamesernator Before, someone proposed the alternative:
```es6
import Foo from "./importers/ini.js"
import config from "./example.ini" as Foo
// ...
```

I'd like to emphasize how this proposal would greatly help the conversion of code that uses AMD loader plugins (also webpack?):
```
define([
  "importers.ini!./example.ini"
  "css!./professional"
], function(config) {
  // ...
});
```

Essentially an AMD loader plugin would be converted into a an object with an `Symbol.importer` method, which has an equivalent signature to that of http://requirejs.org/docs/plugins.html#apiload — I'm almost sure there's something to be learned from there.

Of course, the loader spec surely already tries to mimic this functionality through certain hooks.

If these `Symbol.importer` could handle fetching themselves, through an internal call to fetch or equivalent, then the given "url" could also be given different meanings, and maybe this could be used to support loading NPM style resource names...

Or maybe this "name normalization" would need to be exposed through an alternate method/hook, like `Symbol.importerNormalize`, so that the fetching of the resource itself could be done by the system, and only the `Response` would be given to the `Symbol.importer` function...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/645#issuecomment-334329325

Received on Thursday, 5 October 2017 00:50:01 UTC