I have a simple Ember app and I need to polyfill Object.fromEntries
in a component.
For reference, I use Safari 12.1.1 that supports fromEntries
natively and Safari 11.1.1 that does not.
AFAIK, all I should need is a proper ember-cli-build.js
config.
I would appreciate it if someone could tell me why the following tweaks do not properly polyfill the function:
const app = new EmberApp(defaults, {
'ember-cli-babel': {
// supposedly should inject core-js/stable into app
// @see https://github.com/babel/ember-cli-babel#polyfill
includePolyfill: true,
},
babel: {
// should replace injected core-js/stable with imports
// that are not natively supported by config/targets.js
// @see https://babeljs.io/docs/en/babel-preset-env#usebuiltins-entry
useBuiltIns: 'entry',
// explicitly use corejs v3 per babel-preset-env docs
corejs: 3,
// force inclusion of fromEntries regardless of config/targets.js
include: [
'es.object.from-entries',
],
},
//...
});
I can see it's there: https://github.com/babel/babel/blob/v7.5.5/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js#L265
Package versions:
- ember-source@3.7.2
- ember-cli@3.5.0
- ember-cli-babel@7.5.0
- @babel/core@7.5.5
- core-js@3.2.1
Aucun commentaire:
Enregistrer un commentaire