extjssencha-cmd

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


I'm trying to get my head around ExtJs 7 code. Seeing various default examples There is a file defining the manifest modern.jsonp / classic.json

As a rule, a huge number of libraries are included in these files. Tell me how to customize the manifest yourself and only connect what I need?

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}

And there are hundreds of such lines .. many files are clearly not required by my project, but if I remove some line, then for some reason an error occurs. All these lines are linked to each other. How do I generate a new jsonp?

My project is meant to be a website I basically don't need compilation


Solution

  • Basically you want these files to be added to your .gitignore, because they are auto-generated by Sencha CMD.

    The files inside the *.json and *.jsonp are added by your requirements.

    example

    Ext.define('MyNamespace.view.main.Main', {
        extend: 'Ext.Panel',
        xtype: 'app-main',
    
        requires: [
            'MyNamespace.view.List',
            'PackageA.TestView'
        ],
        uses: [
            'MyNamespace.helper.Dom'
        ]
    });
    

    Sencha CMD runs through the main and finds requires. In order it will add all requirements after the main view.

    As soon as it finds uses it will add these at the end, because it seems they are not important for the order.

    answer You can controll the order of the files by changing the requirements or use uses.