Skip to content

Moving to es6-shim broke most browsers #4216

Closed

Description

@marclaval

In fact, only Chrome and Edge made it through.

As far as I can see, 2 issues are causing this in both unit tests and examples:

  1. Firefox: Error: Expected int32 as second argument in c:/Dev/angular_mlaval/node_modules/es6-shim/es6-shim.js (line 1101)
    This is a known issue in es6-shim: Expected int32 as second argument in Firefox with Array.prototype.map paulmillr/es6-shim#347
    It comes from an actual bug in Firefox, which was apparently fixed in Firefox Nightly.

  2. All other broken browsers: es6-shim doesn't polyfill Symbol and we have a few occurence of Symbol.iterator in the framework.
    Internally, es6-shim uses a string if it doesn't exist, but doesn't expose it.
    Issue opened for that: Expose Symbol.iterator paulmillr/es6-shim#360

Activity

  1. cscott commented on Sep 16, 2015

    @cscott

    Yes, Symbol can't actually be emulated on older browsers, so it is not implemented by the shim. There's an es6-sham class that might be appropriate, though, but caveat user.

  2. cscott commented on Sep 16, 2015

    @cscott

    Out of curiosity -- why are you moving to es6-shim? What did you use before, and why did you switch? (I ask as a contributor to both es6-shim and core-js.)

  3. marclaval commented on Sep 16, 2015

    @marclaval
    ContributorAuthor

    We used to use Traceur, so the shims were provided by the runtime.
    @rkirov did the switch in #4148, I guess he can satisfy your curiosity

  4. rkirov commented on Sep 16, 2015

    @rkirov
    Contributor

    Sorry for the pain @Mlaval, I wasn't aware of the other browser runs (hard to keep track of things outside whatever travis runs). Given that Symbol.iterator is claimed to be a infeasible runtime shim, I wonder how did traceur make it work. If they did some compile time tricks, we can talk to TS folks about replicating them (depending on complexity). The other option is see if we can remove Symbol.iterate, or gracefully degrade for older browsers, i.e. Query is not iterable.

    @cscott We used traceur-runtime before as we were doing traceur transpilation. I am not aware of the pros and cons of es6-shim vs core-js (noone else on the team had opinions about them either) so I just picked one. I would love to hear your take on it. Note that the framework doesn't mandate the use either shim (or any shim), we just need to pick one for our examples and unit tests.

  5. cscott commented on Sep 17, 2015

    @cscott

    If you were using traceur before, you should use core-js now.
    On Sep 16, 2015 6:56 PM, "Rado Kirov" [email protected] wrote:

    Sorry for the pain @Mlaval https://github.com/mlaval, I wasn't aware of
    the other browser runs (hard to keep track of things outside whatever
    travis runs). Given that Symbol.iterator is claimed to be a infeasible
    runtime shim, I wonder how did traceur make it work. If they did some
    compile time tricks, we can talk to TS folks about replicating them
    (depending on complexity). The other option is see if we can remove
    Symbol.iterate, or gracefully degrade for older browsers, i.e. Query is
    not iterable.

    @cscott https://github.com/cscott We used traceur-runtime before as we
    were doing traceur transpilation. I am not aware of the pros and cons of
    es6-shim vs core-js (noone else on the team had opinions about them
    either) so I just picked one. I would love to hear your take on it. Note
    that the framework doesn't mandate the use either shim (or any shim), we
    just need to pick one for our examples and unit tests.

    —
    Reply to this email directly or view it on GitHub
    #4216 (comment).

  6. cscott commented on Sep 17, 2015

    @cscott

    Elaborating slightly: core-js was originally written for Babel, so it fits in better as a complete es6 runtime. See google/traceur-compiler#1976 for example: traceur itself might be using core-js under the hood before long.

    es6-shim's goals are deliberately more modest: not to implement all of ES6, just the "es5 compatible subset". Basically the low-hanging fruit from the es6 spec, and deliberately skipping all the bits which require runtime support, or which can't be perfectly implemented on an es5 runtime (like Symbol). This might be a good thing if you were starting from scratch---it ensures perfect browser compatibility with no hidden gotchas---but you've already got dependencies on an es6 runtime, like Symbol, so it might be more trouble than it's worth to take them out.

    If you wanted to scrub the es6isms from your code, es6-shim will help you keep it that way. If you want things to "just work", core-js will get you there.

    One other nice feature of core-js is its modularity: it is easy to use particular es6 features without polluting the global environment. For library code, this can be a big win.

    Core-js also seems to be slightly faster. es6-shim might have a slightly more complete test suite.

  7. zloirock commented on Sep 17, 2015

    @zloirock

    If you choose to use core-js and if you need any help - welcome :) I'm interesting as minimum because I use angular with core-js in some projects.

  8. added a commit that references this issue on Sep 18, 2015
    390aacd
  9. added a commit that references this issue on Sep 25, 2015
    5606f09
  10. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  11. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions