joeldenning / simple-single-spa-webpack-example

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

'app-1' died in status LOADING_SOURCE_CODE: single-spa-angular must be passed opts.mainModule, which is the Angular module to bootstrap #21

Closed mohamedsamet closed 4 years ago

mohamedsamet commented 5 years ago

Hello, I had created micro front application with two apps angular 5 and angular js. I had used one webpack to compile the code, as entry i created a main js referring to a root js file in which i registred the two apps successfully. Also i added two js file in each app with the lifecycle function. The result is when i change the root to access one of the two apps i had the error 'app-1' died in status LOADING_SOURCE_CODE: single-spa-angular must be passed opts.mainModule, which is the Angular module to bootstrap

joeldenning commented 5 years ago

Hi @samsif, which version of single-spa-angular are you using? Could you provide the code snippet where you're calling singleSpaAngular({...})?

edarioq commented 4 years ago

Also having this issue, using simple webpack example https://github.com/joeldenning/simple-single-spa-webpack-example, any fix for this error ?

Installed a new angular App via the CLI, config:

const ngLifecycles = singleSpaAngular({
  domElementGetter,
  AppModule,
  angularPlatform: platformBrowserDynamic(),
  template: `<app-root />`,
  Router,
  ApplicationRef,
})
joeldenning commented 4 years ago

This example is several years old and does not use Angular CLI. Since I wrote this in 2017, Angular has changed such that it's very difficult to use Angular with your own webpack config instead of Angular CLI. If you're looking for an Angular CLI example, check out https://github.com/joeldenning/coexisting-angular-microfrontends/