PDA

View Full Version : [FIXED] New classes not being picked up



StuartAshworth
16 Apr 2015, 7:06 AM
Hey,

I've just started playing with Ext 6 and am hitting a bit of a brick wall on one of the first hurdles. I think it must be something obvious but I'm not able to figure it out.

I have created a new Universal app with Sencha Cmd 6, and successfully built and launched both the classic and modern versions in the browser.

Now I add a new class to a new namespace in the modern folder (something like modern/src/view/feature/MyComp.js) with a simple Ext.Component. I then require it in the Main.js component that is automatically created and use its xtype in one of the tabs (in exactly the same way as the default List is used).

I then do a sencha app build and refresh the browser. There is always an error in the console complaining about the MyComp file not being found in the common src folder, rather than looking in the modern's src folder.

On digging a bit deeper the modern.json file file never gets updated with the MyComp class (although the xtype is mapped correctly).

I have tried this multiple times starting from scratch and I can't get it to work - any ideas?

Thanks!
Stuart

dongryphon
17 Apr 2015, 8:28 PM
I think there may have a bug with the handling of the appFolder config in a universal app. We are looking into that presently. I am going to move this to the Bugs forum and link it to the bug tracker.

StuartAshworth
18 Apr 2015, 12:22 AM
Thanks Don.I just created another new project and changed the app name to "Todo" from "ToDo" and things seem be working as expected now. Could there be an issue with case-sensitivity?

devnullable
11 May 2015, 12:19 AM
I am having the same problem with universal app. Strangely if I add new MainController.js to modern version it will be picked up correctly only after running sencha app build but when I add new class to for example modern/src/view/somefeature/SomeNewClass.js it is not found even after running build.

Is there any workaround for this bug at the moment? This is quite a showstopper for evaluating Universal app development.

sjoerdl
11 May 2015, 6:59 AM
Also having the same problem: all classes added to the modern/classic packages are not being picked up the builder. I also tried the suggestion from Stuart, unfortunately not using capitals in my app name doesn't seem to make a difference.

dongryphon
11 May 2015, 9:01 AM
@devnullable and @sjoerdl - To make any progress it will help to see some code snippets. The class you added and how you require it from other places. Also when you say "no picked up" what specifically is not happening? Does watch respond, build content not have what you expect, class not get loaded in dev mode? Need to be more specific :)

devnullable
11 May 2015, 9:45 AM
1. Create universal app called Example
2. Create Example/modern/src/view/test/Test.js (xtype: 'test')
3. Modify Example/modern/src/view/main/Main.js to require Test.js:



requires: [
'Ext.MessageBox',
'Example.view.main.MainController',
'Example.view.main.MainModel',
'Example.view.main.List',
'Example.view.test.Test'
]


and assign Test to one of the tabs



{
title: 'User',
iconCls: 'fa-user',
items: [
{
xtype: 'test'
}
]
}


File Test.js is not found when application is loaded in browser because Ext.Loader tries to load it from app/view/test/ instead of modern/view/test/

sjoerdl
11 May 2015, 10:35 AM
Exactly as devnullable describes. Note that when the new project is created, that version actually works: the List.js in modern/classic can be loaded just fine. However, when adding a new class to either the modern of classic package, the framework doesn't seem to be able to pick it up. I have tried with the sencha watch running (started as described in the sencha 6 documentation) as well as building the app explicitly ('sencha app build modern/classic'), both resulting in the same problem. The framework seems to be looking for the new class in the app (shared) package and returning a 404 because it can't find it there. Just naming the class in the requires array is enough already to reproduce the problem.

I am new to sencha, but I guess that the builder from sencha cmd is supposed to update the classic/modern.json files. When I create a new project these files seem to contain references to the path of classic/List.js and modern/List.js (which causes the fresh project to work fine). I noticed that this path was not set for my test class after I build it (although the class name was mentioned at the end of the file, but without any path). I think the problem should be easy to reproduce. If you do require the contents of my modern/classis.json files, I am happy to share it.

bobringer
25 May 2015, 6:02 PM
I'm having the exact same problem. Builds fine, runs fine. Builds fine, runs fine. Builds fine, doesn't run at all.

I've started over and reconstructed my project a second time... this time I was able to work around a few bugs, simplified my project, and really tried to pay attention to what may have caused it to break and I'm really not sure. It seems to be timed around adding new classes to the toolkit/src folder.

Interestingly... the first time I built the project (and after it stopped working), I *WAS* able to get it to work again by deleting classic.json and modern.json. Eventually it broke again and I wasn't able to get a successful build. Now, deleting those two files isn't doing anything.

Running "sencha diag" returns:

app.classpath : app,${toolkit.name}/src

Checking classic.json:

There is no reference to the files in modern/src in the "paths" section.
Interestingly... there *ARE* references to the classes in the classes section.

malfurion559
26 Oct 2015, 4:29 AM
Hello everyone,i think that you have to do a app refreshgoto the root folder of your app an tippe into consolesencha app refreshthen he will rebuild the classic and modern json's and add your new components.

gustavobuenno
20 Jun 2016, 10:51 AM
Try in Sencha CMD this command: $ sencha app watch modern


The default is classic.