Closed out-dev closed 1 year ago
Can you load your config when app is starting?
For example:
@NgModule({
imports: [BrowserModule, HttpClientModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: [{
provide: APP_INITIALIZER,
useFactory: loadConfig,
deps: [HttpClient],
multi: true
}]
})
export class AppModule {}
Yes I can but if forRoot(xxx) is called the providers gets overriden right?
Or what is your idea?
Ps: Great response time ;-)
Unfotunatly "@angular-architects/module-federation" does not provide already loaded MFE Manifest
Yes I can but if forRoot(xxx) is called the providers gets overriden right?
yes
Or what is your idea?
I collect all requirements of your problem, and try to form a universal solution that would suit not only your case
Can you give me more code with your sample ? Have you example repository?
You want load MFE Manifest and provide it to forRoot({ mfeConfig: ##here## }) as Promise or Observable, right? Or you want load all config for configure lib forRoot(##all config as Promise or Observable##)?
Currently my MFE configuration comes from an Api call. I would like to use the result for the following configuration NgxMfeOptions['mfeConfig'].
I can make the API call in the APP_INITIALIZER or in a factory but how can I use the result in forRoot or make it known to the MfeModule for configuration?
Or am I completely blind?
Now i need time to figure out a solution, I m comeback when have solution.
Have you example repository?
Hi, currently I have implement microfrontends with @angular-architects/module-federation and using the manifest concept so basically using loadRemoteModule method in routing with type = 'manifest'
If I implement this library is it possible for ngx-mfe to read the manifest directly as anyhow loadManifest is called in the main.ts ?
Hi, currently I have implement microfrontends with @angular-architects/module-federation and using the manifest concept so basically using loadRemoteModule method in routing with type = 'manifest'
If I implement this library is it possible for ngx-mfe to read the manifest directly as anyhow loadManifest is called in the main.ts ?
Hi, idk, I haven't worked with the mfe concept in production for a long time. Can you provide me with a code sample or repository, it's hard to answer a question without diving into the problem.
@out-dev Hi, you can now try to load your config asynchronously [Pull request #19], like this:
MfeModule.forRoot({
mfeConfig: {
useLoader: (http: HttpClient): Observable<MfeConfig> => http.get<MfeConfig>('/manifest.json'),
deps: [HttpClient]
},
})
Update lib to v15.1.0. Read more here
Will try it out :-)
First - Great job your lib simplifies so much.
Can you offer a way to configure the modul asynchronously.
You could inject the NgxMfeOptions in forRoot or offer another method forRootAsync(options$: Obeservable) | forRootAsync(options$: Promise)
So that the individual mfe configurations can also be obtained via api or fetch.
https://github.com/dkhrunov/ngx-mfe/blob/72b0ec65d761ce67908701cc303f906dc9d36424/projects/ngx-mfe/src/lib/mfe.module.ts#L25