2 questions about ES6 module loaders

Tab Atkins Jr. jackalmage at gmail.com
Sat May 30 19:10:40 UTC 2015

On Sat, May 30, 2015 at 6:57 AM, Glen <glen.84 at gmail.com> wrote:
> I apologize if these are silly questions, but:
> 1. Do ES6 module loaders make use of the browser cache? f.e. If you request
> a JS module and that JS file is in memory/on disk, will it return that file
> instead?

*All* network requests use the browser cache.  Assuming you've set the
correct caching headers, you'll get a cached version when you make a
request a second time.  Only the user can work around this, by
clearing their cache or doing a hard refresh.

> 2. Will ES6 module loaders set a header that indicates that the request is
> not a regular browser request? (similar to how JS libs set an
> X-Requested-With header) If not, will it be possible to add custom headers
> to such requests?

What's the reason for this?

If you implement a custom loader, you can add whatever headers you
want (subject to Fetch restrictions).

> I don't really know which method browsers will use to load modules – I
> assume XMLHttpRequest is used for current polyfills, but I don't know what
> the actual implementations will use (?).

Native loader will use the browser's normal request mechanisms.


More information about the es-discuss mailing list