Dependencies for non-ES modules
Ian Hickson
ian at hixie.ch
Wed Aug 13 16:09:45 PDT 2014
Suppose an ES6 module loads a CSS file as an import, and that CSS file has
an @import rule of its own.
The CSS @import rule semantics are such that the file must be interpreted
as CSS. It's not an open-ended import like ES6. Also, the load must not be
deduped; each style sheet that is @imported will create a new independent
CSSStyleSheet object.
I'm not sure how to implement this using the ES6 Loader (should the ES6
loader even be used for this? It seems like it should, in case we later
support CSS referencing ES6 modules, e.g. for Web Components).
How do I mark a dependency with metadata? If I return an object in the
"deps" field of the "instantiate" hook's result object, and then pass that
through the "normalize" hook, the GetOrCreateLoad() function applies
ToString() to it, so I can't pass any metadata through to "fetch", where
I need it. (If I translate the metadata in the object passed in "deps" in
the "normalize" hook, that string gets exposed as the module name, which
is rather suboptimal.)
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the es-discuss
mailing list