ReactJs 映射在 IE10 中未定义 [英] ReactJs map undefined in IE10

查看:80
本文介绍了ReactJs 映射在 IE10 中未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了类似的问题并尝试了所有方法但没有帮助.

i saw similar questions and tried everything but not helped.

我在 ie10 和 ie11 中发现错误映射未定义.在我的项目上进行此更改后,ie11 有效但 ie10 无效.

I'm getting error map is undefined in ie10 and ie11. After making this changes on my project, ie11 worked but ie10 not.

在我的 package.json 中:

in my package.json:

"browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version",
      "ie 10",
      "ie 11"
    ]
  }

我已经从 npm 安装了 core-js 包,我把我的应用程序放在了我的顶级应用程序 App.js 中:

i have install core-js package from npm and i put in my top level of my app, App.js:

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import "core-js";
import 'core-js/es/set'
import 'core-js/es/map'

通过这些配置,我的应用程序可以在 ie11 上运行,但在 ie10 上不能运行.我能做什么?

with these configuration my app works on ie11 but on ie10 not. What can i do ?

推荐答案

您可能需要为 Array.map() 安装额外的 polyfills 才能处理 旧浏览器.

You might need to install additional polyfills for Array.map() to work on older browsers.

首先,我们安装 polyfill 库,

First, we install the polyfill library,

npm i react-app-polyfill

然后,我们在您的应用的 index.js/index.ts 中导入所需的 polyfill.

Then, we import the required polyfills in the index.js/index.ts of your app.

import 'react-app-polyfill/ie9'

这篇关于ReactJs 映射在 IE10 中未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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