Results 1 to 8 of 8

Thread: How to detect missing classes in 'require'

  1. #1
    Sencha Premium User
    Join Date
    May 2013
    Location
    Netherlands
    Posts
    24

    Default Answered: How to detect missing classes in 'require'

    My app is running smoothly in de development-mode, but when I generate the app for production (sencha app build...) and upload it, it only shows the opening-page and after the login-dialog it does not show anything. In debugging I see the loading of some stores, but then nothing happens.... No errors in de console...

    I ran into the same situation earlier and in most cases I forgot to include some classes, but know I can't see which classes I forgot to include.

    Is there an easy way to get a list of which classes I have to include (require...) in my ow classes or overrides?

    Any help is appreciated.

    regards,

    Arno

  2. First thing I would do is remove or comment out the entry in app.json that loads ext-all-debug.js. After running that Sencha app watch command, it will regenerate the meta data and you will now load individual classes for Ext JS. Ext JS should also warn you in the browser’s console when it has to load a class sync which is telling you that you need to require that class.

  3. #2
    Sencha User
    Join Date
    Jun 2017
    Posts
    25
    Answers
    1

    Default

    I don't know the answer to your question regarding checking requirements - but I am wondering if maybe your stores are timing out? If you have event listeners attached to the load of the store, they could be timing out thus preventing the rest of the page from being rendered correctly (if the layout is dynamic).

    If you don't get a better answer, you may try this: put all the classes you might be using in the requires, then use the process of elimination to determine what you're missing. Usually it gives a nice message in the console if I'm missing a required class...

  4. #3
    Sencha Premium User
    Join Date
    May 2013
    Location
    Netherlands
    Posts
    24

    Default

    Hi acg,
    Thanks for the ideas and suggestion.

    No, the stores do not time out. Each store checks for this type of error and/or situation.

    What I already did was adding all 'named' classes and xtypes to the requires-array property, but still no succes.

  5. #4
    Sencha Premium Member
    Join Date
    Oct 2013
    Location
    Slovakia
    Posts
    80
    Answers
    2

    Default

    You can try to generate and run testing build of your application. If there are some errors in production build, you should see them also in testing build, but with more detailed descriptions.

  6. #5

    Default

    Hi, Arno.

    I think I have the same problem as you.

    I used to develop with "sencha app watc(banned) [development]", and when I went to "sencha app build testing|production", everything stopped working, lot of classes were missing, ...

    The case is that, in my opinion, there is something very wrong about developing with "app watc(banned)": it preloads all the framework and a lot of stuff, but when you do a build, Sencha Cmd parses all your code looking for the "requires" and only packages the referenced classes.

    I always asked myself how could something like this was working:

    Code:
    Ext.define('.... blablabla.B', {
    
        requires: 'Bla.blablabla.foo.bar.baz.tons.of.words.A',
    
        statics: {
            a: Bla.blablabla.foo.bar.baz.tons.of.words.A
        }
    ...
    }) ;
    in sencha "app watc(banned)" works perfectly: sencha command detects that you will use that "A" class and before defining B, it is already loaded. I was letting my imagination fly about each code file being parsed by Ext.JS before defining a class -because it is not possible to create the options object with a requires and referenced that same class-; and no, there is no magi(banned)c: "app watc(banned)" is tricking us. In this case I have to require the "A" class in Application (for example), or now I make singletons to autoregister themselves once loaded, like here.

    And there is a big flaw in "app watc(banned)": it does not warn about all missing requires. Although it is very useful to rapid develop an application without caring about requires, but be aware that you will have problems later on builds.

    The real behaviour is the present in "app build", where you have to require on your classes what you will be using.

    So, my recommendation: stay away from "app watc(banned)" unless you are working with Fashion, and run your application in a Tomcat/Jetty/Ngix/whatever using "app build development". The missing requires will pop out as errors or warnings in the console.


    P.S.: Please, can someone at Sencha fix the banned words issue?

  7. #6
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,451
    Answers
    3997

    Default

    First thing I would do is remove or comment out the entry in app.json that loads ext-all-debug.js. After running that Sencha app watch command, it will regenerate the meta data and you will now load individual classes for Ext JS. Ext JS should also warn you in the browser’s console when it has to load a class sync which is telling you that you need to require that class.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  8. #7
    Sencha Premium User
    Join Date
    May 2013
    Location
    Netherlands
    Posts
    24

    Default

    Hi,
    I solved the issue, but it would be nice if some sencha cmd would be avaialable whichs only checks the required classes, and suggest which to include

    This is what I did:
    - I started sencha app watch
    - I comment out all my lines of code including the required classes.
    - After building the new (empty) classes I rebuild the classes piece by piece untill the system stopped working. In my case the problem was caused by dynamically loading the columns definition of a grid.

    I hope this helps.

    Arno

  9. #8

    Default

    Quote Originally Posted by mitchellsimoens View Post
    First thing I would do is remove or comment out the entry in app.json that loads ext-all-debug.js.
    Never thought about that. Thanks, Mitchell =) Good to read from the wise exdevelopers

Similar Threads

  1. Ext.require for non-Ext classes
    By prashantjain68 in forum Ext: Q&A
    Replies: 2
    Last Post: 10 Dec 2013, 11:49 AM
  2. How to set additional require statements to classes
    By hschaefer123 in forum Sencha Architect 2.x: Help & Discussions
    Replies: 0
    Last Post: 12 Apr 2012, 1:48 AM
  3. Can I use Ext.require for my own classes
    By VaZia in forum Ext: Discussion
    Replies: 2
    Last Post: 6 May 2011, 8:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •