diff --git a/package.json b/package.json index ab41cfbda3072baf8a3e01099732a1c01457d209..271a008e0dad543c8f4fc6d082fe700cfed74768 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 cfa30d2246a92a3aa8bab697bee2e0d021fcc538..27a33c83374bc8081bcaf361a2fe44ed8fc7f079 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 0000000000000000000000000000000000000000..ad1eb6b9a483f1ee5ad2950729109058360d3aa5 --- /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;