-
26 Sep 2012 2:04 PM #1
Sencha Cmd v3 errors
Sencha Cmd v3 errors
Hello,
I'm trying to generate a bootstrap file and I seem to be getting some unexpected results. Here is the syntax I am using:
sencha compile -classpath=app,lib/extjs/src/ux meta -alias -out bootstrap.js and meta -alt -append -out bootstrap.js
When I do that, I get an error:
I'm using a ux for routing (https://github.com/brunotavares/Ext.ux.Router). I take it Sencha Cmd is doing static code analysis and it is expecting to see where the function returns an object literal, whereas in this case it returns a variable containing an object?Code:Sencha Cmd v3.0.0.141 [INFO ] Processing classPath entry : C:\myproject\sencha-compile-temp-dir [INFO ] Processing classPath entry : app [INFO ] Processing classPath entry : lib\extjs\src\ux [ERROR] Detected Ext.define call with function parameter, but definition function did not return object literal [INFO ] Concatenating output to file bootstrap.js [INFO ] Appending concatenated output to file bootstrap.js [ERROR] Parent directory did not exist :
When I try removing all references to Ext.ux.Router and run this:
sencha compile -classpath=app meta -alias -out bootstrap.js and meta -alt -append -out bootstrap.js
I get this:
I'm not sure exactly what that means--what parent directory? The bootstrap file still generates correctly, though. However, the bootstrap file ends up with a peculiar entry:Code:Sencha Cmd v3.0.0.141 [INFO ] Processing classPath entry : c:\myproject\sencha-compile-temp-dir [INFO ] Processing classPath entry : app [INFO ] Concatenating output to file bootstrap.js [INFO ] Appending concatenated output to file bootstrap.js [ERROR] Parent directory did not exist :
"MyApp.app.Application"
I have an index.html page referencing the bootstrap file and in my app.js, I have it requiring MyApp.*. When I attempt to run my index.html, I get a 404 when it tries to load that Application class. I'm not sure why it is generating that. I have no such class in my app--I'm simply calling Ext.application in my app.js. When I manually remove it from the bootstrap file, the app works correctly and when I actually build it, it proceeds without errors.
For reference, I'm using 4.1.1a and my html file looks like this:
Code:<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title id="page-title">MyApp</title> <link rel="stylesheet" type="text/css" href="resources/css/MyApp.css"> <!-- <x-compile> --> <!-- <x-bootstrap> --> <script type="text/javascript" src="lib/ExtJs/ext-all-dev.js"></script> <script src="bootstrap.js" type="text/javascript"></script> <!-- </x-bootstrap> --> <script type="text/javascript" src="app/app.js"></script> <!-- </x-compile> --> </head> <body> </body> </html>
-
26 Sep 2012 2:46 PM #2
Moved to Sencha Cmd forums for better response.
Scott.
-
27 Sep 2012 12:09 AM #3
Don Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
-
27 Sep 2012 9:25 AM #4
It sure is pretty particular about the arguments being passed into Ext.define. I would think that the first argument (the name of the class) would be the main thing that the bootstrap generation logic cares about. If somebody does some crazy dynamic stuff to generate the object for the second argument that it doesn't understand, maybe it could just output a warning instead of an error and go ahead and add the class to the bootstrap file anyhow?
I still haven't figured out how to get around the other issues I mentioned before. Upgrading to build 4.1.2a didn't have any effect. I have attached a very simple sample project to demonstrate. The sample project pretty much follows the standard Sencha conventions and the command I'm running is pretty plain vanilla:
The bootstrap.js file generated looks like this:Code:sencha compile -classpath=app meta -alias -out bootstrap.js and meta -alt -append -out bootstrap.js
The only JavaScript file in the app is app.js, so I'm not sure why it's generating a bootstrap entry for an "Application" class. Running the index.html results in an immediate error because it can't resolve that class.Code:Ext.ClassManager.addNameAliasMappings({ "Test.app.Application": [] });
It's also still getting the "Parent directory did not exist : " error. I'm not sure if that's actually a problem or whether I can just ignore it. It doesn't really provide enough information for me to look into it further.
Any help would be greatly appreciated.
Note: In order to reduce the file size for upload, I had to remove the contents of the lib/ExtJs folder in my sample, so those will need to be replaced before using it.
-
28 Sep 2012 2:52 AM #5
I created a new app with Sencha Cmd and moved in my project, and now I am able to get the whole process to work at least. My previous project didn't have a .sencha directory, and now that it does, I'm able to run Sencha App Refresh to generate the bootstrap. Doing the bootstrap directly like I was doing before still results in the same error about the parent directory, but whatever--I'll just use Refresh. It also still adds the same "Application" entry to the bootstrap, but now the app doesn't error.
To get the Routing class to work, I changed the function being passed into Ext.define so that instead of setting an object literal to a variable and returing the variable, it just returns the object literal directly. I guess it's pretty nifty that the bootstrap generator is even able to recognize that. I suppose it can be argued that creating classes much more dynamically than that sort of defeats the purpose of having a class system anyhow.
-
29 Sep 2012 12:15 AM #6
We will look at removing the faux-class for the application. Thanks for reporting that. I have logged this as SDKTOOLS-172.
Yes, the compiler needs to understand various things from the class body (e.g., 'extends', 'requires', 'uses', 'mixins', 'override' and soon more to enable deeper optimizations). This is definitely a change for some classes to adapt to, but as you said, it yields more understandable, declarative code.
So are you still having any specific problems?Don Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
-
29 Sep 2012 4:35 AM #7
Thanks for your response and for following up on the "faux-class" issue. Turns out that the "faux-class" still causes an error as soon as I require MyApp.*. For now I'm working around it by adding an Ext.define in app.js, but it would be nice if that weren't necessary.
And of course, the other issue I saw was the "Parent directory did not exist" error. I was able to reproduce that even in a newly generated app. As I said, the bootstrap generation still works, so it's not much of a problem.
-
30 Sep 2012 10:30 PM #8
I'm going to open a ticket to look in to the parent directory issue - thanks for reporting it!
Success! Looks like we've fixed this one. According to our records the fix was applied for
SDKTOOLS-180
in
3.0.0.190.


Reply With Quote

