Sencha Cmd v3 build error when implementing Bryntum Scheduler - extjs

Using Cmd 3.0.0.141, I have successfully generated a workspace and an Ext app in that workspace. The application builds correctly until I attempt to integrate the Bryntum Scheduler, where I encounter an error when I try to build:
"Failed to resolve dependency Sch.panel.SchedulerTree for file ExtCalendar.view.Tree"
the app is very simple at this point, uses Ext.application and follows the MVC pattern where I have a view defined "ExtCalendar.view.Tree" that extends 'Sch.panel.SchedulerTree". I also have models and stores that extend Bryntum classes as well, so I assume the compiler will trip over those as well, since it can't see the Sch namespace.
I've added a 'js' path to my app.json that points to the bryntum js file where 'Sch.panel.SchedulerTree' comes from. I've tried to run the 'refresh' command with the same results (Failed to resolve...). I've regenerated the bootstrap.js file manually using 'compile', but nothing from the Sch namespace ever gets added to it, despite the Brytum lib file being in the classpath.
What do I need to do in order to successfully run the 'build' command with libs like this?
Or, do I need to take a more granular approach using the 'compile' command?

With the help of the nice folks on the Sencha forums, I was able to resolve my build issues. The solution, for me, involved a shim. I added an external shim.js file to my index with as many //#require and //#define directives as needed in order to resolve the dependency issues.
According to the nice folks at Bryntum, once I upgrade from the free-trial version of the Bryntum Scheduler, I will be able to get rid of the shim and simply rely on the sencha.cfg classpath pointing at the Bryntum src.
Also, as an aside, the app.json file is not used in ExtJS apps, its inclusion in the generated files was a bug in build 141 of Cmd v3.
See this thread for more detail.

Related

React suddenly responding with index.html instead of javascript imports

Recently I've been unable to load javascript scripts to my webworkers in react for some reason. It always responds with index.html.
My config is simply a standard create-react-app app. The screenshots are from my actual project but I have confirmed that the problem persists if I create a new project and try to initialize a minimal example.
Each ffmpeg.* file is affected. This is also not specific to ffmpeg since another library had the same issue - thankfully the initialization of that library is simpler so I was able to simply put that libraries worker-file in the public folder - and that worked.
It might be a stupid question but I'm really at my wits end here and I can't figure out how to investigate further.
Thank you <3
EDIT:
It works if I put all the files it is trying to hit in the public folder - so it has to be some kind of context issue(??) This seems like a really stupid way to go about it. It's not in a worker at the point of loading - it's the worker loader that fails to access the stuff it needs in the node_modules folder, (core script, worker script and wasm code). Whet?

Can I use sencha cmd as to minify/compress?

We have an ExtJS modern app. We would like to use cmd to minimize/compress our code into a single .js file - effectively doing what a non Ext app would do with other minifiers like uglifyjs or terser.
I believed we could achieve this with the compile command such as:
sencha -sdk ext-7.1.0.46 compile -cl=myclassfolder -inp=ES6 concat outfile.js
However, it complains that it can't find the Ext classes with an error like:
[ERR] Failed to resolve dependency Ext.data.Model for file myapp.model.mymodel
[ERR] Unknown definition for dependency : Ext.data.Model
It seems to be the basic task of extending Ext.data.Model it doesn't like and very much feels like I simply need to reference the extJS class structure correctly for this to work, but can't figure out the command line to make it happen (I somewhat assumed that the sdk reference would fix this).
Is this possible?
Ok, to help anyone who is facing the same problem and wants to compress/minify their ExtJS but without creating a full sencha app.
The command is fairly simple and the answer is to include the path to your dependent js files in the -cl (or -classpath) argument, then exlude the Ext namespace:
sencha -sdk stack/Sencha/ext-7.2.0 compile -cl=ext-modern-all.js,packages/ux/modern/ux.js,myclassfolder -inp=ES6 exclude -namespace Ext and concat outfile.js
You can then use terser or your preferred minify tools to minify/mangle the output (or add the compress command to the above to allow cmd to minify also). It's a reasonable way to build your ExtJS code into several manageable extjs "modules" which can be loaded when needed (or when security allows) rather than the "big bang" approach of cmd.
This will produce a single js file, correctly ordered, the only issue is that it includes the Ext microloader code, which it adds by default. I have not managed to have the compiler not inlcude the microloader, however you can effectively disable it by defining the microloader yourself between the load of your ext-all.js file and your newly created file by using something like this is another file or inline script tag:
Ext.Microloader = {
run: function(){}
};
I know there aren't many folks left using ExtJS, hope this helps someone at some point, at worst case it allows a bit more control of the ExtJS build process.

Reduce size/number of files being downloaded from EXTJS app

I used Sencha CMD to build an app and want to ensure that I'm only downloading what is required for the app to run. I have read some places that the way to do this is by using the Required [] clause to only include the required classes, however I don't think I understand this clearly. For example I have a page that has an {xtype: 'grid'} within it, but I haven't put Requires : [ 'Ext.grid.Panel' ], yet it still displays properly. In my mind if I haven't included the requires, and CMD is doing what I think it should, this page should fail to load because Ext.grid.Panel wasn't included. The fact that it's working is making me think that CMD is automatically including it for me, but what else is it automatically including and potentially bloating the download? How can I ensure that I'm only downloading what's required for the app to run?
I found the answer to my problem. I was developing my app on the same server that I'm serving it from, and when I was running "sencha app build production", it's putting all of the "build" files into a separate directory. I was assuming the microloader/bootstrap process was then going to look in that directory but I guess that's not how it works. I had to then copy those "build" files to a new directory and include my index.html and bootstrap.js in the new directory and then it appears to work, only loading the required files. It's certainly not clear anywhere that this is what's required. Hopefully this will help anyone else having the same issue.

Sencha Cmd build error while building an ExtJs App extending 3rd party classes (non-extJs classes)

I have an extJs 4 app that is extending 3rd party non-extJs classes. I just can't seem to build the app. It keeps giving me the error below. Objective is to minify the app with appropriate dependencies since it is taking longer time to load both libraries and slowing down the application.
I am using Sencha Cmd v4.0.4.84.
/*********************************************/
C2008: Requirement had no matching files
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExBuild: Failed to find any files
/*********************************************/
Any help is truly appreciated.
So far I have tried:
1) modified app/.sencha/app/sencha.cfg classpath to include the external library. No luck.
2) Added to section of the index.html. No luck.
3) Added loaders and set path of the external library. No luck.
External library is already on my local machine inside of the app folder.
Anyone out there?
I take you out for a lunch if you help me resolve this issue. No seriously!
This is really a showstopper for me.
Thank you,
Ritesh
Issue is resolved in the Sencha Forum post below.
http://www.sencha.com/forum/showthread.php?285252-Sencha-Cmd-build-ExtJs-with-external-library&p=1043385#post1043385
If you can't get to the link then....
If a testing build works and production build does not you might try disabling optimizations. If you look in ".sencha/app/production.defaults.properties" you will see the various settings that make production builds unique.
Try adding this setting:
build.optimize=${build.optimize.disable}
Hope this will help someone.
Thanks,
Ritesh
You cannot extend a 3rd party class as Ext.define expects that all classes inherit from Ext.Base what is unlikely for non-ext 3rd party lib.
Of course, you can use a third party lib by including its javascript outside of <x-compile> block in your index.html

jTwitter, oAuth, and Google App Engine. NoClassDefFoundError

I'm trying to use jTwitter to get an oauth instance to twitter with my consumer key/secret and access token/secret. This is well documented in the javadoc here. I have downloaded signpost, signpost-jetty, and the jtwitter library, but after deploying and running the servlet, I get a error java.lang.NoClassDefFoundError: winterwell/jtwitter/OAuthSignpostClient Eclipse isn't complaining about the class not being there, because it is there-- I can see it in the JAR file itself, which is in my project. So, I said forget it, I'll try out OAuthScribeClient instead, but this generated a VERY SIMILAR ERROR java.lang.NoClassDefFoundError: org/scribe/oauth/Token This one confuses me even further because I have the following code in my java file, and it compiles without error or warning:
import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");
Clearly, I'm missing something very fundamental, but I am at an absolute loss as to what it may be. Thanks.
Usually "NoClassDefFoundError" happens when you forget to copy all jar-files to your "/war/WEB-INF/lib" directory, so those libs will be unavailable from server-side.
Xo4yHaMope is probably right.
If you're working from Eclipse but running using a web container, then your runtime classpath might be different from your project classpath - which can cause this error.
In order to complete Ben Winters answer what I actually did and worked is add the jar in
the libs folder within the project
see also here about folder hierarchy.
When you do this eclipse will normally add the jar to the android dependencies before launching the application. What I realise is that adding a jar in the build path will make classes available only during the build

Resources