joeldenning / coexisting-angular-microfrontends

Multiple angular applications, coexisting in one page via single-spa.
MIT License
225 stars 154 forks source link

Issue with $localize() after upgrading to angular 9 #65

Closed baggelisp closed 4 years ago

baggelisp commented 4 years ago

Hello, After upgrading angular version to 9 and single-spa 5 i get the following error:

Screenshot from 2020-07-31 12-06-09

The error was caused due to angular 9 version using global $localize() function.

The solution here: https://stackoverflow.com/questions/57953317/angular-9-introduced-a-global-localize-function-that-needs-to-be-loaded fixes the problem by adding theimport '@angular/localize/init'; to your polyfills.ts

After reading this: https://single-spa.js.org/docs/ecosystem-angular#polyfills

I have to import @angular/localize/init and its dependencies in the index.html file. Can you help me importing the modules in the root-html-file. I dont want to import by npm. I want similar to this:

<script src='https://unpkg.com/core-js-bundle/minified.js'></script>

Thanks

joeldenning commented 4 years ago

I would try adding import '@angular/localize/init to your main.single-spa.ts file. Angular 9's Ivy Compiler makes it quite hard to load angular libs via script tag.

baggelisp commented 4 years ago

Thanks! You solved my issue!