Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Gnorro opened this issue Jan 16, 2020 · 0 comments
Open

Comments

@Gnorro
Copy link

Gnorro commented Jan 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant