将babel polyfill添加到React Native Project [英] Add babel polyfill to React Native Project
问题描述
我在android上遇到问题.收到此错误:
I´m having a issue on android. Got this error:
未定义不是函数(评估'_iterator2typeof Symbol ==='function'?Symbol.iterator:'@@ iterator'´)
undefined is not a function(evaluating '_iterator2typeof Symbol==='function'?Symbol.iterator:'@@iterator'´)
我认为这与for for es6的使用有关.
I think it is related to the use of for of, es6.
我可以将babel-polyfill
添加到React Native Project吗?
Can i add babel-polyfill
to React Native Project ?
推荐答案
为了添加 babel-在安装
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';
现在,您可以使用新的内置函数,例如Promise
或WeakMap
,静态方法(例如Array.from
)和实例方法(例如Array.prototype.includes
等)
Now you can use new built-ins like Promise
or WeakMap
, static methods like Array.from
and instance methods like Array.prototype.includes
, etc.
这篇关于将babel polyfill添加到React Native Project的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!