[英]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.