react页面兼容ie步骤

The React App is not compatible IE default.If open this app in IE,it will display a blank page.So, you must modify some files .
Step 1:
npm install --save es5-shim es5-shim/es5-sham console-polyfill fetch-ie8 babel-polyfill
Step 2:
Modify this apps entry file that called "index.js"

require('es5-shim');
require('es5-shim/es5-sham');
require('console-polyfill');
require('fetch-ie8');
require('babel-polyfill');
const React = require('react');
const ReactDOM = require('react-dom');
const App = require('./App').default;

ReactDOM.render(, document.getElementById('root'));

finally,the content of pakage.json file is:

{
"name": "XXX",
"version": "0.1.0",
"private": true,
"dependencies": {
"antd": "^2.12.7",
"axios": "^0.16.2",
"babel-polyfill": "^6.7.4",
"bootstrap": "^3.3.7",
"classnames": "^2.2.5",
"console-polyfill": "^0.2.2",
"es3ify-loader": "^0.2.0",
"es5-shim": "^4.4.1",
"eventsource-polyfill": "^0.9.6",
"fetch-ie8": "^1.4.0",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"redux": "^3.7.2",
"script": "^0.1.4",
"webpack": "^3.10.0"
},
"devDependencies": {
"react-scripts": "1.0.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"description": "This project was bootstrapped with Create React App.",
"main": "index.js",
"author": "",
"license": "ISC"
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值