Search code examples
angulartypescriptpolyfills

.NET Core 1.1.0 and Angular 2 app: Can't find variable:WeakMap on Safari


I've deployed a .NET Core 1.1.0 + Angular 2 + Typescript app on ASPHostPortal. Everything works fine from Chrome and Firefox but when I try to open the site from Safari I get the following exception on the console:

Can't find variable:WeakMap

and the site doesn't start, stucking on "loading" screen.

How can I solve this?

EDIT

Sakuto solution solves weapmap issue but now the safari console showns these errors:

enter image description here

Someone knows what is the problem? Obviously on Chrome and Firefox the site keep working fine.


Solution

  • WeakMap is not implemented in Safari as stated in the MDN

    You can, however, use a polyfill to handle this. The other solution would be to use Angular CLI which will handle everything for you, from the bundling to the deploying.