Aspnetcore-angular-universal: Core JS 'Math' polyfill not working in IE - Webpack doesn't target es 5

Created on 24 Jul 2018  路  3Comments  路  Source: TrilonIO/aspnetcore-angular-universal

In my tsconfig the target is set to ES5. However, when I run the application or publish it, I get an error in IE 11:
image
It's in dutch, but saying ':' is expected.
When diving in the source code, the following line gives the error:
image
Because IE11 does not support ES2015 Enhanced Object literals (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Object_literals)

This code is from the Core JS, specifically from the polyfill 'core-js/es6/math'.
When I comment this line in my polyfills.ts, the error is gone.

How can I get this file to be compiled as ES5?

Most helpful comment

In webpack.config and webpack.config.vendor change option of UglifyJsPlugin ecma: 6 to ecma: 5.

All 3 comments

In webpack.config and webpack.config.vendor change option of UglifyJsPlugin ecma: 6 to ecma: 5.

Indeed, this worked! I thought that it only applied to production builds, because the UglifyJsPlugin is added if isDevBuild = false.

It solved my problem too, thank you so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naveedahmed1 picture naveedahmed1  路  3Comments

artyom-p picture artyom-p  路  3Comments

consigliory picture consigliory  路  3Comments

Gandii picture Gandii  路  3Comments

AbrarJahin picture AbrarJahin  路  4Comments