【问题标题】:How do I detect cyclic dependent modules in UI5?如何检测 UI5 中的循环依赖模块?
【发布时间】:2022-12-10 13:28:25
【问题描述】:

鉴于:

// In my/ModuleA.js
sap.ui.define([
  "./ModuleB"
], function (ModuleB) {
  // ModuleB is undefined here ..
});
// In my/ModuleB.js
sap.ui.define([
  "./ModuleA"
], function (ModuleA) {
  // ModuleA is undefined here ..
});

构建并运行应用程序后,检查生成的Component-preload.js显示my/ModuleA.js中的ModuleB参数或my/ModuleB.js中的ModuleA参数为undefined

在一个小项目中很容易检测到这种循环依赖。但是如果有多个模块并且它们的依赖关系很复杂,我如何轻松地检测到这样的缺陷呢?

【问题讨论】:

    标签: sapui5 amd


    【解决方案1】:
    1. 打开浏览器控制台并确保启用查看所有“详细”日志。
    2. 使用以下 UI5 config URL parameters 运行应用程序:
      • sap-ui-xx-debugModuleLoading 的值为 true
      • sap-ui-logLevel 的值为 ALL
    3. 在日志中,按“检测到周期”过滤。

    【讨论】:

      猜你喜欢
      • 2011-10-21
      • 1970-01-01
      • 1970-01-01
      • 2014-04-28
      • 1970-01-01
      • 1970-01-01
      • 2013-08-19
      • 1970-01-01
      • 2018-03-17
      相关资源
      最近更新 更多