webpack: "production" mode is causing an exception in IE11

Bug report

What is the current behavior? I am bundling my TypeScript application with Webpack 4, and compiling with Babel. When using mode: "production" in "webpack": "^4.42.1", I get the error Unhandled promise rejection Typeerror: Object doesn’t support this action in IE11. The error doesn’t occur in any other browsers, and it doesn’t occur when using “developement” or “none” mode. Because the other modes are working, I assume that the error is due to a “production” mode configuration, and not (directly) related to my babel config. My guess is that some “production” config is not playing nice with Babel.

I have been trying to reverse-engineer the issue by using the same production config found here with mode: "none" to try and produce the same error. Once the issue can be re-produced without mode: "production", it should be straightforward to deduce the culprit option. So far I have not had any success. The snippet provided does not contain the TerserPlugin config, and for all I know might not actually be a 1:1 match of “production” mode.

If the current behavior is a bug, please provide the steps to reproduce. Not sure this is possible because I cannot reproduce outside my codebase, which is private.

What is the expected behavior? If mode: "development" bundle output is IE11 compatible, I would expect mode: "production" to be as well.

Other relevant information: webpack version: 4.42.1 Node.js version: v13.8.0 Operating System: macOS Catalina 10.15.4 Additional tools: IE11

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (10 by maintainers)

Most upvoted comments

@NicHaley I actually discovered that just including the custom-event-polyfill solved this in my case!

I can try and set one up

Maybe bug with tree shaking, maybe bug in minificator - terser, maybe in external plugins/loaders, maybe in your code, we don’t need all the code, just a small example that broken in IE11