Edgaras Karka
Edgaras Karka

Reputation: 7852

require('core-js/es6/map') polyfill not working for spread Map object on IE11

I use TypeScript and Babel.

I have code like:

 const map1 = new Map(...);
 const map2 = new Map(...);
 const foo = [...map1, ...map2];

If I import just:

require('core-js/es6/map');

above code (spreading) not work as expect (IE 11), but if I import:

require('core-js');

code works as expect.

How to import just necessary functionality for spread Map objects?

Upvotes: 0

Views: 3571

Answers (2)

Vitalii Retel
Vitalii Retel

Reputation: 11

I've found that it needs

import 'core-js/fn/symbol/for';

Upvotes: 1

hsz
hsz

Reputation: 152206

You should give a try with babel-plugin-transform-object-rest-spread. In my case, when using babel-preset-env, object spreading was not available by default.

Upvotes: 0

Related Questions