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:
- importing
react-app-polyfill/ie11
andreact-app-polyfill/stable
at the top ofindex.js
- importing
core-js/es/object/entries
andcore-js/features/object/entries
at the top ofindex.js
- Adding the following to
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:
create-react-app
as per the GitHub issue you've referenced. Perhaps downgrading to an older version until this gets resolved would be one of the options here. – Bill