繁体   English   中英

IE11:如何在 Internet Explorer 中的 React 中填充 `Array.values().next()`?

[英]IE11: How to polyfill `Array.values().next()` in Internet explorer, in React?

我在 IE11 中运行的 React 项目中的迭代器遇到问题。

这是重现问题的最少代码量;

// index.js

...
import React from 'react'
import ReactDOM from 'react-dom'
import 'core-js'
import 'whatwg-fetch'
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

const a = [1,2,3,4].values().next();
console.log(a);
...

在 IE11 中,我收到一条错误消息

SCRIPT438: Object doesn't support property or method 'next'

我已经导入了整个 'core-js' 库,我还需要导入什么来在 IE11 中填充此功能?

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

作为 index.js 中的前两行https://www.npmjs.com/package/react-app-polyfill

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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