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

> ```js
> import x from 'y.html' as Document;
> ```
>
> I think this syntax would be really useful if there was a way to hook into this and customize how raw data fetched by the loader were handled at runtime - i.e. a define a function that converts ArrayBuffers to something representing a module record. Maybe `Symbol.importer`? I think it would be necessary to import your importer [1] for the concept of 'referencing an import in an import statement' to make any sense though [2]: 

Right, we need TC39 to define some hooks to let the host language and authors to define a custom importation behavior. The way you defined `Symbols.impoter` is exactly I'd imagine this feature would be defined.

We could even add a sugar on top of it to improve the developer ergonomics further like letting the host language pick a custom importer automatically based on MIME type. e.g. "X.css" could automatically use StyleSheet's `Symbol.importer` but that's sort of nice-to-have.

-- 
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-310823900

Received on Saturday, 24 June 2017 08:05:46 UTC