joeldenning / simple-single-spa-webpack-example

A simple example of how to use webpack with single-spa
MIT License
292 stars 94 forks source link

How to register Angular lazy loaded modules #23

Open Harry-027 opened 4 years ago

Harry-027 commented 4 years ago

When using registerApplication method from single-spa, where are we informing it about the lazy loaded bundle (for Angular app). Let's say I have a different repo for angular micro frontend. Prod build gives me 2 bundles - main.js & lazy.js, While registering app in shell app I'm referencing main.js bundle. What will happen to lazy.js. How would single-spa come to know about other bundle which has to be lazily loaded ?

joeldenning commented 4 years ago

Hmm I am not sure what lazy.js is. Are you using angular 8? Or this repo with angular 2?

You might want to check out the single-spa angular-cli plugin and coexisting-angular-microfrontends repo which configure the webpack config correctly for Angular 8.

Harry-027 commented 4 years ago

I'm using Angular6 & following required steps for using single-spa. Lazy.js is a separate bundle generated for a lazy module when bundled using single spa builder. I'm not sure how to let shell app know about this bundle when registering the micro app.