Add babel polyfill to React Native Project

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

I think it is related to the use of for of, es6.

Can i add babel-polyfill to React Native Project ?

回答1:

In order to add babel-polyfill to your react-native project after installing

npm install --save babel-polyfill

just import it like this in your entry endpoint:

import 'babel-polyfill';

Now you can use new built-ins like Promise or WeakMap, static methods like Array.from and instance methods like Array.prototype.includes, etc.



回答2:

You can use

npm install es6-symbol --save 

Then add in your index.android.js & index.ios.js

import 'es6-symbol/implement' 


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