ie浏览器兼容


  • react项目兼容ie 
npm install react-app-polyfill --save

  在入口文件(index.js)顶部引入

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

  package.json中修改

  "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"
    ]
  }

  *** 开发版本中不起作用,打包之后生效

  • 浏览器引擎前缀

 

火狐 -moz
safari/谷歌  -webkit-
Opera -o-
IE -ms-