question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Polyfill/Core-JS not Included with Versions 7+

See original GitHub issue

The latest versions of this repo do not appear to include the core-js polyfill when configuring:

'ember-cli-babel': {
  includePolyfill: true
}

…in the ember-cli-build.js file.

Here’s a branch demonstrating the issue, with a failing test: https://github.com/spencer516/babel-issue/tree/babel-7

Here’s the same, but with version 6.16, with a passing test: https://github.com/spencer516/babel-issue/tree/babel-6

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ggayowskycommented, Mar 8, 2019

@Frozenfire92 Here is my solution.

Install the cjs transform addon (https://github.com/rwjblue/ember-cli-cjs-transform):

ember install ember-cli-cjs-transform

Import the file in ember-cli-build.js:

    // ember-cli-build.js
    app.import('node_modules/core-js/fn/array/flat-map.js', {
        using: [{ transformation: 'cjs', as: 'flat-map-polyfill' }]
    });

In app.js, import the module (using the alias you defined)

    // app.js

    // TODO: Remove when flat-map & flat reach stage 4
    // https://github.com/tc39/proposal-flatMap
    import 'flat-map-polyfill';
1reaction
ggayowskycommented, Mar 8, 2019

@rwjblue I don’t know who is the maintainer of this package, but my recommadation would be to close this issue as it is not a problem with ember-cli-babel, but a breaking change in babel 7 where by the polyfill file no longer includes polyfills for < Stage 4 proposals (as @Frozenfire92 mentioned above).

@spencer516 and the example he included is just that flatMap is not included with the polyfills file.

I have posted a work around / solution for including < stage 4 proposals that should help with the migration from ember-cli-babel 6.x.x to 7.x.x

Read more comments on GitHub >

github_iconTop Results From Across the Web

core-js - npm
Modular standard library for JavaScript. Includes polyfills for ECMAScript up to 2023: promises, symbols, collections, iterators, typed arrays, ...
Read more >
Module not found: Error: Can't resolve 'core-js/es6'
To resolve this error, you can downgrade the core-js version to 2.5.7. This version produces correct catalogs structure, with separate ES6 ...
Read more >
7.4.0 Released: core-js 3, static private methods and partial ...
This release includes support for TypeScript 3.4, the proposal for partial application in function calls, and static private methods. We added ...
Read more >
Browser support - Angular
This includes the following specific versions: ... You might need additional polyfills to support features not covered by this list.
Read more >
How to load polyfills only when needed
If you use core-js 2, useBuiltIns: "usage" will fail to add some of the newer polyfills. For example, it won't polyfill this code:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found