Search code examples
extjssencha-architectsencha-cmd

ExtJS include View in cmd build


I use ExtJS 5. I use Sencha Architect.

I have 2 views: View1 (alias: widget.view1) and View2 (alias widget.view2). Those views are declared in views folder but are not linked in application. One of them is created at runtime and added to container in beforerender:

component.add({xtype: 'view' + type});

where type variable is calculated earlier.

I build app with

sencha app build testing

and in created JS file there is no View1 neither View2 included. Also there is no appropriate ViewController neither ViewModel.

Then I've added subsections in app.json file in section js:

  {
     "path": "app/view/View1.js",
     "x-compile": true,
     "includeInBundle": true
  },
  {
     "path": "app/view/View1ViewController.js",
     "x-compile": true,
     "includeInBundle": true
  },
  {
     "path": "app/view/View1ViewModel.js",
     "x-compile": true,
     "includeInBundle": true
  },

and rebuild app. Now the View1 class is available in compiled JS and also during runtime.

Question: how can I make SA to modify app.json file? There is a file app.json.meta created by SA (I guess). The content of both files is similar.


Solution

  • I've found solution. I need to add AppName.view.View1 and AppName.view.View2 to requires table of container where I need to add views.