Реагировать на полифилы за ie> = 9 - PullRequest
0 голосов
/ 14 апреля 2020

Я пытаюсь настроить React App для IE 9+ браузеров. Вот мой текущий пакет sr c.

. json

{
  "name": "react-ts-template",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@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/crypto-js": "3.1.44",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1",
    "typescript": "~3.7.2",
    "crypto-js": "^4.0.0",
    "react-app-polyfill": "1.0.6",
    "core-js": "3.6.4",
    "regenerator-runtime": "0.13.5",
    "raf": "3.4.1"
  },
  "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 >= 9"
    ],
    "development": [
      "ie >= 9",
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

index.ts

//polyfills
import 'core-js/stable';
import 'regenerator-runtime/runtime'
import 'react-app-polyfill/ie9';
import 'react-app-polyfill/stable';
import 'raf/polyfill';

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

Но я работаю только в режиме разработки в IE 11. В IE 10-9 работает только в производственной сборке. В dev он показывает ошибку в консоли:

Map is not defined

Что я делаю не так? Может быть, я что-то пропустил в конфигурации?

...