question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IE11 no longer works when upgrading react-scripts from 3.4.3 to 4.0.1 (react-scripts 4.0.1 is not compatible with react-app-polyfill 1.0.6 or 2.0.0)

See original GitHub issue

Describe the bug

I get the following error when launching IE11 after upgrading to react-scripts v4.0.1: Error: You must pass a component to the function returned by connect. Instead received { "$$typeof": 60112, "propTypes": {}, "displayName": "WithStyles(MainAppBar)", "options": { "defaultTheme": { "breakpoints": { "keys": [ "xs", //material-ui stylesheet reduced for brevity } }

I didn’t get this when using react-scripts 3.4.3, nor do I see any problem launching the application in Chrome. I’ve also updated the react-app-polyfill from v1.0.6 to v2.0.0, and this hasn’t helped.

The first couple of items from the stack trace are:

wrapWithConnect C:/IS Transfer/Source/React/react/node_modules/react-redux/es/components/connectAdvanced.js:187

Anonymous function C:/IS Transfer/Source/React/react/src/components/mainAppBar/index.js:38

Did you try recovering your dependencies?

YES (although I admit when I hadn’t initially followed these steps!)

npm --version 6.14.9

Which terms did you search for in User Guide?

IE Internet Explorer

Environment

λ npx create-react-app --info npx: installed 67 in 7.85s

Environment Info:

current version of create-react-app: 4.0.1 running from C:\Users\Shiraz.Esat\AppData\Roaming\npm-cache_npx\27724\node_modules\create-react-app

System: OS: Windows 10 10.0.18362 CPU: (12) x64 Intel® Core™ i7-9850H CPU @ 2.60GHz Binaries: Node: 12.13.1 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 6.14.9 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 86.0.4240.183 Edge: Spartan (44.18362.449.0) Internet Explorer: 11.0.18362.1 npmPackages: react: ^16.14.0 => 16.14.0 react-dom: ^16.14.0 => 16.14.0 react-scripts: 4.0.1 => 4.0.1 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

(Write your steps here:)

  1. Get latest project code
  2. Install packages with npm install
  3. Build and run project with npm run

Expected behavior

Code is build, and available at http://localhost:3000/ Default browser launches, but same location could be browsed with other browsers A welcome page should be shown whether opened in Chrome, Firefox, Edge, or IE11

(Write what you thought would happen.) I expected babel to use the pollyfill to create a package suitable for IE11. That is, the minified JS should be suitable to run in IE. What is generated for Chrome, Firefox, and Edge doesn’t need the polyfill, which is why these work ok. Older versions of react-scripts instructed babel how to build the scripts for supported browsers, but something is not working now. This part of package.json determines what rules are needed during transpilation: "browserslist": { "production": [ ">0.2%", "not dead", "not ie < 9", "not op_mini all", "firefox esr", "unreleased versions" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version", "ie 11" ] },

I expected less browser support in the development build, and more in the product build (when npm run build is used and the generated files are deployed to a web server). Both builds, though, don’t work with IE11.

Actual behavior

I get the error described in the description. This is a screenshot of IE11: image

This is the same react application in Chrome: image

Reproducible demo

I will raise this issue without a reproducible demo, but will now work on trying to get something minimal. Hopefully in the meantime someone may know what is causing this! It could be related to react-redux, and how react-scripts work now in v4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20

github_iconTop GitHub Comments

6reactions
sorinpavcommented, Dec 17, 2020

I have tried to run it with IE11 and I’m getting this inside the console. Has anyone else encountered the same issue and has a workaround? image

2reactions
markpassandocommented, Dec 18, 2020

Yes, 4.0.X definitely has issues. I downgraded to 3.4.4, I was able to get the webapp to render with 3.4.4 but as soon as other code executed it failed on other es6 syntax. I’ve tried globally importing core-js (in additional to react-app-polyfill) and explicitly importing the methods IE11 is complaining about. No luck.

Previously when I had this running all i had in index.js was

import 'react-app-polyfill/ie11'
import 'react-app-polyfill/stable'

Let me know if you have any luck @shiraze

Read more comments on GitHub >

github_iconTop Results From Across the Web

"react-app-polyfill" doesn't work in IE11 - Stack Overflow
As a workaround, you could try to downgrade the react-scripts version. As far as I know, it can still work with react-scripts@3.2.0 ....
Read more >
IE 11 Not work on builded React code - PDF.js Express
I use your React Sample to create my program. When i run “npm start” at the localhost, the IE 11 can 100% success...
Read more >
react-scripts: Versions - Openbase
Create React App 5.0 is a major release with several new features and the latest version of all major dependencies. Thanks to all...
Read more >
React app is not working on internet explorer
If you used create-react-app in your package.json there is browserslist key which lists supported browsers. Eldhose ...
Read more >
You need to update your react-script package. As craco@6.4 ...
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found