Does Babel transpile Map to be usable in IE11?

旧时模样 提交于 2020-01-15 12:09:24

问题


Looking at Map documentation, it looks like it is not fully supported in IE11: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

Does Babel convert Map.set and Map.get to be functional for IE?


回答1:


The easy part is figuring out what the different transpilers and browsers support. See this link for this information. From this you can see what portion of Map is supported by IE11, for example, and of course, what Babel support is like (quite good for Map with polyfill - see below). Just click on 'Map' in the left column to expand it to a detailed list of capabilities needed to support that feature.

The trick is figuring out what plugins are required by Babel, and according to their documentation, it requires the babel polyfill:

Support via polyfill In order to support Maps, Sets, WeakMaps, and WeakSets in all environments you must include the Babel polyfill.

You can see the babel docs here



来源:https://stackoverflow.com/questions/42491429/does-babel-transpile-map-to-be-usable-in-ie11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!