I am working on a react app bootstrapped using create-react-app and it works perfectly in Chrome but I cannot get it to work in IE11.
Upon launching the app, I am getting the following error from the console:
Object doesn't support property or method 'entries'
I have spent hours trawling Google trying to find a solution and none of the recommended ones work.
Things I have tried:
react-app-polyfill/ie11
and react-app-polyfill/stable
at the top of index.js
core-js/es/object/entries
and core-js/features/object/entries
at the top of index.js
index.js
:if (!Object.entries) {
Object.entries = function( obj ){
var ownProps = Object.keys( obj ),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--)
resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};
}
package.json:
{
"name": "ceas-ui",
"version": "0.1.0",
"private": true,
"dependencies": {
"auth0-js": "^9.8.2",
"bootstrap": "^4.1.3",
"core-js": "^3.6.4",
"env-cmd": "^8.0.2",
"joi-browser": "^13.4.0",
"react": "^16.12.0",
"react-app-polyfill": "^1.0.6",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-loader-spinner": "^2.3.0",
"react-modal": "^3.8.1",
"react-router-bootstrap": "^0.25.0",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.3.1",
"react-slidedown": "^2.4.5",
"react-toastify": "^4.5.2",
"styled-components": "^5.0.0"
},
"scripts": {
"start": "react-scripts start",
"test": "cls && react-scripts test --coverage --env=jsdom",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browser": {
"joi": "joi-browser"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"chai": "^4.2.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.9.0",
"jsdom": "^13.2.0",
"mocha": "^6.0.0",
"react-test-renderer": "^16.8.2",
"rimraf": "^2.6.3"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all",
"ie 11"
],
"development": [
">0.2%",
"not dead",
"not op_mini all",
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
"ie 11"
]
}
}
References:
You can downgrade your react-scripts version. In your package.json , alter to "react-scripts": "3.2.0".
Take a look at https://github.com/facebook/create-react-app/issues/8405.
It seems to be an issue with react-scripts
version 3.3.0 and higher. You could find many issue reports in GitHub, for example: github.com/facebook/create-react-app/issues/8197, github.com/facebook/create-react-app/issues/8195.
It can still work with [email protected]
. You could try to revert back to 3.2.0 as a workaround. Please also remember to delete .cache
folder in node_modules
and delete IE browser cache then try again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With