0

I am building a webiste using Angular 2 with Visual Studio 2019 project template. I have been able to successfully publish it and it is working correctly in most browsers. I have been doing some testing using BrowserStack.com on different devices and found that in certain earlier versions of Safari and iOS I get an error in the console which prevents the page from loading completely. The error is as follows:

main-es5.4856ef6….js:1 TypeError: undefined is not a function (evaluating 'db(e,t)')

If I edit the .csproj file and build the project without the --prod parameter this error does not occur anymore at all. So I presume this is a problem in the minification of one of the Angular 2 dependencies.

How would I exclude this Angular dependency from the minification process but still allow my components and css to be minified or is there another solution? I tried to edit the .tsconfig file and added this to the excludes section but it did not work at all.

"exclude": [
  "./dist/main-es2015.js",
  "./dist/main-es5.js"
]

Any help or thoughts on this would be appreciated?

lschmid
  • 183
  • 1
  • 1
  • 11

1 Answers1

0

I ended up solving this by setting the "target": "es5" property in the tsconfig.json file which stopped the error message.

See Angular 2 / 4 / 5 not working in IE11

Along with implementing a unsupported browser component page if Safari < 10 and IE < 11.

lschmid
  • 183
  • 1
  • 1
  • 11