Standard modules - concept or concrete?

Sam Tobin-Hochstadt samth at ccs.neu.edu
Thu Jun 20 09:08:56 PDT 2013


On Thu, Jun 20, 2013 at 10:26 AM, Kevin Smith <zenparsing at gmail.com> wrote:
> I wonder, though, if this might create issues for polyfilling:
>
>     // polyfillz.js
>     if (this.Promise ===  void 0)
>         this.Promise = function() { ... }
>
>     // main.js
>     import "polyfillz.js";
>     new Promise();
>
> This would refuse to compile, right?  We'd have to introduce all of our
> polyfills in a separate (previous) compilation/execution cycle.

Yes, like so:

    <script src="polyfillz.js"/>

Note that this is already the way people suggest using polyfills; see
[1] for an example.

Sam

[1] https://github.com/axemclion/IndexedDBShim


More information about the es-discuss mailing list