You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 16模块联邦加载远程模块时出现TypeError: Cannot read properties of undefined (reading 'ɵmod')错误求助

Angular 16模块联邦加载远程模块时出现TypeError: Cannot read properties of undefined (reading 'ɵmod')错误求助

大家好,我现在在使用Angular 16.2.12开发壳应用(shell),尝试通过模块联邦加载远程模块时遇到了问题,希望能得到大家的帮助!

我用来加载远程模块的路由配置代码如下:

const routes: Routes = [
  { 
    path: 'cat', 
    loadChildren: () => {
      return loadRemoteModule({
        remoteEntry: REMOTE_MODULE,
        remoteName: "CatModule",
        exposedModule: "./CatModule"
      }).then(m => m.CatModule).catch(err => console.log(err))
    }
  }
];

但目前在壳应用中加载模块时出现了错误,具体错误提示如下:

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)

已经卡了好一会儿了,有没有朋友遇到过类似的问题,或者能给我一些排查的方向?非常感谢!

备注:内容来源于stack exchange,提问作者Omkara

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 10:44:31