From fce74f92ce3c737ca48db07fba8bb10ee5fe39ab Mon Sep 17 00:00:00 2001 From: yoyo837 Date: Wed, 27 Jun 2018 11:40:50 +0800 Subject: [PATCH] Compatible with IE10 --- package.json | 3 ++- src/index.js | 3 +-- src/polyfill.js | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/polyfill.js diff --git a/package.json b/package.json index ab41cfbd..271a008e 100755 --- a/package.json +++ b/package.json @@ -45,14 +45,15 @@ "react-dom": "^16.4.1", "react-fittext": "^1.0.0", "rollbar": "^2.3.4", + "setprototypeof": "^1.1.0", "url-polyfill": "^1.0.10" }, "devDependencies": { "babel-eslint": "^8.1.2", "babel-plugin-dva-hmr": "^0.4.1", "babel-plugin-import": "^1.6.7", - "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-module-resolver": "^3.1.1", + "babel-plugin-transform-decorators-legacy": "^1.3.4", "cross-env": "^5.1.1", "cross-port-killer": "^1.0.1", "enzyme": "^3.1.0", diff --git a/src/index.js b/src/index.js index cfa30d22..27a33c83 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,4 @@ -import '@babel/polyfill'; -import 'url-polyfill'; +import './polyfill'; import dva from 'dva'; import createHistory from 'history/createHashHistory'; diff --git a/src/polyfill.js b/src/polyfill.js new file mode 100644 index 00000000..ad1eb6b9 --- /dev/null +++ b/src/polyfill.js @@ -0,0 +1,12 @@ +import '@babel/polyfill'; +import 'url-polyfill'; +import setprototypeof from 'setprototypeof'; + +// React depends on set/map/requestAnimationFrame +// https://reactjs.org/docs/javascript-environment-requirements.html +// import 'core-js/es6/set'; +// import 'core-js/es6/map'; +// import 'raf/polyfill'; 只兼容到IE10不需要,况且fetch的polyfill whatwg-fetch也只兼容到IE10 + +// https://github.com/umijs/umi/issues/413 +Object.setPrototypeOf = setprototypeof; -- GitLab