【问题标题】:How to use ext-debug.js with ExtJs 5.0?如何在 ExtJs 5.0 中使用 ext-debug.js?
【发布时间】:2015-04-02 15:12:47
【问题描述】:

在 ExtJs 4.2 中,我在开发环境中一直使用ext-debug.js。与ext-all-debug.js 相比的优势在于,每个类都作为单独的文件加载,因此开发人员工具中的回溯更加清晰。

我从 ExtJs 4.2 升级到 5.1,我的 app.json 看起来像:

/**
 * Comma-separated string with the paths of directories or files to search. Any classes
 * declared in these locations will be available in your class "requires" or in calls
 * to "Ext.require". The "app.dir" variable below is expanded to the path where the
 * application resides (the same folder in which this file is located).
 */
"classpath": "${app.dir}/app",
/**
 * The Sencha Framework for this application: "ext" or "touch".
 */
"framework": "ext",
"js": [
    {
        "path": "${framework.dir}/build/ext-all-rtl-debug.js"
    },
    {
        "path": "app.js",
        "bundle": true
    }
],

当我将行改为

"path": "${framework.dir}/build/ext-debug.js"
  • sencha 构建失败并出现此错误

    [INF] Capturing theme image
    [ERR] loading page W%3A/mbgest25dev/sass/example/theme.html
    registering ready listener...
    [E] [Ext.Loader] Some requested files failed to load.
    ... dozens of times the same error
    
  • ext-debug.js 已加载,但所有类都加载了错误的 URL(并出现 404 错误) GET http://example.com/packages/sencha-core/src/class/Mixin.js?_dc=1427986581354 而不是 GET http://example.com/app-directory/ext/packages/sencha-core/src/class/Mixin.js?_dc=1427986581354

当然,sencha app build 中的错误与浏览器中的错误相同。

必须有一个缺失的配置告诉ext-debug.js 在哪里寻找框架,而ext-all-rtl-debug.js 不需要知道。

如何配置 ExtJs 5.0 以使用 ext-debug.js 以便能够从更清晰和更相关的堆栈跟踪中受益?

编辑:

将 ext 框架类的路径添加到 classpath(如 "classpath": "${app.dir}/app,${app.dir}/ext",)并没有帮助。 sencha cmd 给出了一些警告,最终构建应用程序失败。

【问题讨论】:

    标签: extjs extjs5


    【解决方案1】:

    如果你删除这些行

    {
            "path": "${framework.dir}/build/ext-all-rtl-debug.js"
    }
    

    在 app.json 中,您将实现您想要的(Ext 将加载您的 bootstrap.json 文件中写入的所需类)。

    【讨论】:

    • 非常感谢。这阻碍了我将我的应用程序升级到 ExtJs 5。同时 ExtJs6.0 出来了。我目前无法检查您的答案是否正确,但可以肯定的是,这让我可以在某个时候尝试升级到 Ext 6.0。
    【解决方案2】:

    这个配置可以在三个地方处理,通常按以下顺序:

    • .sencha/sencha.cfg
    • app.json
    • app.js(或 Application.js)

    如果您从 Ext JS 4 升级,很有可能它在 sencha.cfg 中。寻找 app.frameworkapp.classpath

    接下来检查 app.json,并寻找可以覆盖它的相同设置。如果所有其他方法都失败了,请尝试通过使用 paths 属性(将命名空间映射到目录结构的对象映射)针对 app.js 中的 Ext.application 设置它们来强制您的路径。

    【讨论】:

    • app.json 中包含的文档说 framework 应该是 extsencha。另一方面,classpath 告诉加载器应该在哪里寻找应用程序的类。就我而言,它是"classpath": "${app.dir}/app"。添加${framework.dir}${app.dir}/ext 对我来说没有意义,不是吗?我会试一试,但我持怀疑态度。
    • 我尝试了您推荐的方法,但无法正常工作。见编辑。也许您可以提供一些更具体的建议?
    • 您能否向我们展示您的 bootstrap.json 在应用程序刷新/编译后的输出?你的基础包目录没有正确设置,如果没有看到你的一些配置文件就很难说。
    • 问题是 bootstrap.json 大约 76k。我还尝试了使用sencha generate app 生成的应用程序,即使这样,也无法使用ext-debug.js。行为完全相同。我使用 ExtJs GPL 5.1.0.107 和 Sencha Cmd 5.1.2.52。如果即使是干净的标准应用程序也不是使用 ext-debug.js 构建的,它在我看来就像 ExtJs 中的一个错误。
    • 我仔细查看了 bootstrap.json,它看起来不错。据我所知,问题的根源不在此文件中。第一个出错的请求是到http://domain/packages/sencha-core/src/class/Mixin.js,而bootstrap.json 正确包含:"Ext.Mixin":"ext/packages/sencha-core/src/class/Mixin.js"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多