React Typescript是否可以在Internet Explorer 11中使用?

问题描述 投票:0回答:1

我有许多可在Internet Explorer 11(带有polyfills)中工作的React应用程序。我想在下一个应用程序中使用TypeScript,因此我使用了与其他应用程序相同的技术和概念来开发了我的第一个应用程序。问题是我只能在该浏览器中看到一个空白页面,并且出现许多错误(从西班牙语翻译):

字符集范围无效。

对象不接受'repeat'属性或方法(此对象出现26次)。

这是我的package.json:

{
  "name": "reportes",
  "homepage": "http://localhost:8080/isset/view/funeraria/reportes",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.9.8",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/lab": "^4.0.0-alpha.47",
    "@mdi/js": "^5.0.45",
    "@mdi/react": "^1.4.0",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "@types/jest": "^24.0.0",
    "@types/node": "^12.0.0",
    "@types/react": "^16.9.0",
    "@types/react-dom": "^16.9.0",
    "@types/react-router-dom": "^5.1.3",
    "axios": "^0.19.2",
    "core-js": "^3.6.5",
    "exceljs": "^3.8.2",
    "file-saver": "^2.0.2",
    "moment": "^2.24.0",
    "react": "^16.13.1",
    "react-app-polyfill": "^1.0.6",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1",
    "react-select": "^3.1.0",
    "react-to-print": "^2.6.3",
    "typescript": "~3.7.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all",
      "ie 11"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version",
      "ie 11"
    ]
  }
}

而且我的index.tsx中有此导入:

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

您能帮我解决这个问题吗?

reactjs typescript internet-explorer internet-explorer-11
1个回答
0
投票

repeatnot supported by IE。您需要add polyfill。对于其他错误,您还可以检查是否使用了IE不支持的某些语法,然后尝试为它们查找polyfill。

此外,请在src / index.tsx的第一行添加import 'react-app-polyfill/ie11'; import 'react-app-polyfill/stable';。>>

© www.soinside.com 2019 - 2024. All rights reserved.