>
> Will heterogenous transpiling in a web app be supported? Can a JS
> module depend on a CoffeeScript file, and vice versa?
>
Right - Sam's example of having a specific CoffeeScript loader isn't going
to actually work for this reason. Instead, we'd have to figure out which
"to-JS" compiler to use inside of the translate hook.
let maybeCoffeeLoader = new Loader(System, {
translate(src, relURL, baseURL, resolved) {
// If file extension is ".coffee", then use the coffee-to-js
compiler
if (extension(relURL) === ".coffee")
src = coffeeToJS(src);
return src;
}
});
You could use the resolve hook in concert with the translate hook to create
AMD-style plugin directives. It looks pretty flexible to me.
One question, though: branching on the file extension, as above, will not
generally work. The source code might be served through a URL that does
not have a file extension. On the web though, we'll generally have access
to a Content-Type header. In the current design, there's doesn't appear to
be a way to get that information.
One possibility for getting the Content-Type header would be to override
the fetch hook and use cross-domain XHR, but that seems like a lot of
duplicated code just to get data that's already being received by the
browser.
Thoughts?
- Kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss