In IE11, repeat polyfill seems to fail when uncaught exception is thrown
See original GitHub issueBug report
Describe the bug
When testing in IE, I get a white screen when an uncaught exception is thrown rather than the standard error message page or something more user friendly.
To Reproduce
- yarn create next-app
- Add a
throw new Error('boom')to the top of pages/index.js yarn dev- Observe the difference between IE11 and other browsers
Expected behavior
IE11 should have the same behavior for this case as other browsers
Screenshots
System information
- OS: Windows 81
- Browser IE11
- Version of Next.js: 9.3.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (11 by maintainers)
Top Results From Across the Web
In IE11, repeat polyfill seems to fail when uncaught exception ...
When testing in IE, I get a white screen when an uncaught exception is thrown rather than the standard error message page or...
Read more >Angular 2 / 4 / 5 not working in IE11 - Stack Overflow
I was asked in the comments by @jackOfAll whether IE11 polyfills are loaded even if the user is in an evergreen browser which...
Read more >String.prototype.replaceAll() - JavaScript - MDN Web Docs
A new string, with all matches of a pattern replaced by a replacement. Exceptions. TypeError. Thrown if the pattern is a regex that...
Read more >Error Boundaries - React
Use static getDerivedStateFromError() to render a fallback UI after an error has been thrown. Use componentDidCatch() to log error information.
Read more >Converse.js API Documentation Source: headless/dist ...
indexOf(chr); // Throw exception if character is not in the lookup string; ... else { throw new SyntaxError('[sprintf] failed to parse named argument...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Narrowed down the issue some more:
The error
"TypeError: Object doesn't support property or method 'repeat'"occurs on the expressionl(a.marker,"^").repeat(h)in the minified source filenode_modules/next/dist/compiled/react-error-overlay/index.js.The error is only produced when we throw an error at module execution time (rather than at render time).
e.g. this is ok
but this fails
Repro:
Open the app in IE11, and you’ll see the error:
Observe that
String.prototype.repeatis undefined when thel(a.marker,"^").repeat(h)expression is evaluated by replacing it withe.g.
So, the issue seems to be that Next.js’s polyfills module is not being loaded prior to executing the
pages/index.jsmodule.We can probably include it! Feel free to send a PR.