mohammedzamakhan / ngx-loadable

⏳ Simple Lazy Loading for Non Routable Angular Modules
https://mohammedzamakhan.github.io/ngx-loadable/
MIT License
165 stars 21 forks source link

ModuleConfig was previously added, it will not be added multiple times #34

Open Gnorro opened 4 years ago

Gnorro commented 4 years ago

Hi

I updated ngx-loadable to version 2.1.1 because Iupdated our app to angular 8.

What we did in our code in previous version (angular 7.2.5 and ngx-loadable version 1.0.10) was:


"lazyModules": [
              "src/app/features/layout-root/footer/footer.module",
...
...
...
            ]

Then in our core.module:


import { lazyloadFilemappings } from 'app/config/lazyload-filemappings';

LoadableModule.forRoot({
      fileMappings: lazyloadFilemappings
    })

where lazyload-filemappings.ts is:


export const lazyloadFilemappings = {
  'footer': 'src/app/features/layout-root/footer/footer.module#FooterModule',
...
...
...

After updating to v.2.1.1 fileMappings property is no more available. I read that configuration is different.

I think this is the right configuration now:


LoadableModule.forRoot({
      moduleConfigs: [{
        name: 'footer',
        loadChildren: () => import("../features/layout-root/footer/footer.module").then(mod=> mod.FooterModule),
        matcher
      }]
    })

so I used that in core.module

When I run app I get this warning: ngx-loadable - ModuleConfig with name 'footer' was previously added, it will not be added multiple times, continue... Cattura1

I get this warning multiple times and it continues to infinite and the app is blocked.

Why this happens? What's wrong? I also tried to remove "lazyModules" from angular,json without luck.

If I use only LoadableModule in core.module then I get error: TypeError: "this.options is null" on this line: <ngx-loadable [show]="true" [module]="'footer'">

and naturally footer is not loaded

Thanks for your help