How to tell WebPack Uglify to support IE8

Many that uses WebPack also applies the UglifyjsPlugin.  By default, UglifyJS doesn't support IE8.  There's a few problems that we'll see:

IE8's non-standard catch is a keyword, so as a property it will be renamed to "catch": and promise["catch"]()

IE8's non-standard class is a keyword, so similarly it needs to be escaped as "class".

The UglifyJS settings needed for WebPack.config is this:

    new webpack.optimize.UglifyJsPlugin({
      mangle: {
          // mangle options, if any
      },
      mangleProperties: {
        screw_ie8: false,
        //ignore_quoted: true,      // do not mangle quoted properties and object keys
      },
      compress: {
        screw_ie8: false, 
        //properties: false // optional: don't convert foo["bar"] to foo.bar
      },
      output: {
        screw_ie8: false         
      }
    })

 

Yes, by default, UglifyJS has screw_ie8 = true