将babel polyfill添加到React Native Project [英] Add babel polyfill to React Native Project

查看:75
本文介绍了将babel polyfill添加到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';

现在,您可以使用新的内置函数,例如PromiseWeakMap,静态方法(例如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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆