Error while loading remote module in angular module federation. TypeError: Cannot read...

Discussão em 'Angular' iniciado por Omkara, Fevereiro 19, 2025.

  1. Omkara

    Omkara Guest

    This query is regarding loading remote module in host (shell) application. I am using Angular 16.2.12.

    Code to load remote module is as below:

    const routes: Routes = [

    {
    path: 'cat',

    loadChildren: () => {
    return loadRemoteModule( {

    remoteEntry: REMOTE_MODULE,
    remoteName: "CatModule",
    exposedModule: "./CatModule"
    }).then( m=> m.CatModule).catch( err => console.log(err))
    }
    }];


    however currently getting error while loading module in host app (shell), here are error details


    ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'ɵmod')
    ​

    TypeError: Cannot read properties of undefined (reading 'ɵmod')
    at getNgModuleDef (core.mjs:2055:29)
    at new NgModuleRef (core.mjs:22683:29)
    at NgModuleFactory.create (core.mjs:22721:16)
    at router.mjs:4160:40
    at map.js:7:37
    at OperatorSubscriber._next (OperatorSubscriber.js:13:21)
    at OperatorSubscriber.next (Subscriber.js:31:18)
    at subscribe.innerComplete (mergeInternals.js:25:28)
    at OperatorSubscriber._next (OperatorSubscriber.js:13:21)
    at OperatorSubscriber.next (Subscriber.js:31:18)
    at getNgModuleDef (core.mjs:2055:29)
    at new NgModuleRef (core.mjs:22683:29)
    at NgModuleFactory.create (core.mjs:22721:16)
    at router.mjs:4160:40
    at map.js:7:37
    at OperatorSubscriber._next (OperatorSubscriber.js:13:21)
    at OperatorSubscriber.next (Subscriber.js:31:18)
    at subscribe.innerComplete (mergeInternals.js:25:28)
    at OperatorSubscriber._next (OperatorSubscriber.js:13:21)
    at OperatorSubscriber.next (Subscriber.js:31:18)
    at resolvePromise (zone.js:1193:31)
    at resolvePromise (zone.js:1147:17)
    at zone.js:1260:17
    at _ZoneDelegate.invokeTask (zone.js:402:31)
    at core.mjs:10757:55
    at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:10757:36)
    at _ZoneDelegate.invokeTask (zone.js:401:60)
    at Object.onInvokeTask (core.mjs:11070:33)
    at _ZoneDelegate.invokeTask (zone.js:401:60)
    at Zone.runTask (zone.js:173:47)


    Help is appreciated. Thanks.

    Continue reading...

Compartilhe esta Página