简体   繁体   中英

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?

我发现它需要

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM