ExtJS 7 - 如何自定义 modern.jsonp 清单文件?

ExtJS 7 - How to customize the modern.jsonp manifest file?

我正在努力了解 ExtJs 7 代码。查看各种默认示例 有一个定义清单的文件 modern.jsonp / classic.json

通常,这些文件中包含大量库。告诉我如何自定义清单并只连接我需要的?

Ext.Microloader.setManifest(
{"paths":
{
"Ext":"ext/modern/modern/src"
}
,"loadOrder":
[
{"path":"ext/packages/core/src/Ext.js","requires":[1],"uses":[],"idx":0},
{"path":"ext/modern/modern/overrides/init.js","requires":[],"uses":[],"idx":1},
{"path":"ext/packages/core/src/lang/Error.js",
"requires":[0],"uses":[],"idx":2},{"path":"ext/packages/core/src/lang/Array.js",
"requires":[0,2],"uses":[4],"idx":3},{"path":"ext/packages/core/src/lang/Assert.js",
"requires":[0,2],"uses":[],"idx":4},{"path":"ext/packages/core/src/lang/String.js",
"requires":[0,3],"uses":[],"idx":5},{"path":"ext/packages/core/src/lang/Date.js",
"requires":[0,5],"uses":[3],"idx":6}

并且有数百行这样的行..我的项目显然不需要很多文件,但是如果我删除了一些行,那么由于某种原因会发生错误。 所有这些线路都相互关联。 如何生成新的 jsonp?

我的项目是一个网站我基本上不需要编译

基本上您希望将这些文件添加到您的 .gitignore,因为它们是由 Sencha CMD 自动生成的。

*.json*.jsonp里面的文件是按您的要求添加的。

例子

Ext.define('MyNamespace.view.main.Main', {
    extend: 'Ext.Panel',
    xtype: 'app-main',

    requires: [
        'MyNamespace.view.List',
        'PackageA.TestView'
    ],
    uses: [
        'MyNamespace.helper.Dom'
    ]
});

Sencha CMD 跑遍main,找到require。为了它会在主视图之后添加所有要求。

一旦找到 uses 它就会在末尾添加这些,因为看起来它们对订单来说并不重要。

回答 您可以通过更改要求或使用 uses.

来控制文件的顺序