1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    9
    Answers
    1
    Vote Rating
    0
    lex_won is on a distinguished road

      0  

    Default Answered: production build issues with Sencha Touch 2

    Answered: production build issues with Sencha Touch 2


    Hello,

    I currently have a Sencha Touch 2 application that has been written and tested in a local IIS environment.
    When I deploy it to an IIS server (our DEV environment) the application takes a long time to load up all the library files that are required.
    I then used the Sencha SDK tools to create a 'production' build.

    In order to test the build I have deployed it again to my local IIS environment but get the following errors in the application

    error.jpg
    By tracing back through the code I can see that the errors occurs when I call setHtml('') on a list object.

    What else can I do to further debug the issue? The problem only occurs after I do the build.

    Thanks

  2. I don't know how much this helps.... but I have previously discovered that code in the global scope executes in a different order after minimization.

    The reason for this is that Sencha Command builds the single app.js file so that the Ext.Application call is right at the bottom. Usually it would be the first code executed; after a production build it's essentially the last (in the global scope at least).

    My bet is that your ID strings are therefore in the minimized file being set too late, and you're trying to reference them before they're set perhaps? So no element is found when you try to get an element with a null ID.

  3. #2
    Sencha User
    Join Date
    Mar 2012
    Location
    The Netherlands
    Posts
    75
    Answers
    13
    Vote Rating
    4
    SebasSP is on a distinguished road

      0  

    Default


    Your list object doesn't exist (yet). You may want to call setHtml() after the initlialize event of the list.

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    9
    Answers
    1
    Vote Rating
    0
    lex_won is on a distinguished road

      0  

    Default


    Is there a way to debug which setHtml call is causing the issue.
    It is not apparent which call could be the issue.
    1. I call it on the list.load event handler but the load does not occur until after view is initialized (which is created in the application.launch)
    2. I have a call to setHtml in the keyUp event of a search box (which is created as part of the view definition)
    From the looks of it both cases occur after the application has been initialized.
    Additionally if the object not being set was the cause of the problem would I see the error before I use the 'production' build of the application?

    Thanks

  5. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    9
    Answers
    1
    Vote Rating
    0
    lex_won is on a distinguished road

      0  

    Default


    After a bit more investigation it looks like alot of my components are not being assigned ID's.
    At the very top of my app.js file I have global constants like the following

    Code:
    //global constants
    var NEW_SEARCH_BTN_ID = 'newSearchBtn';
    var SEARCH_HOME_INPUT_ID = 'searchQueryBox';
    var SEARCH_PREVIEW_LIST_ID = 'searchPreviews'; 
    var SUBMIT_SEARCH_BTM_ID = 'submitSearchBtn';
    Those constants are what I use to ID my components and then retrieve them afterwards.
    Could the build process affect the scope of these ID's since they are defined in app.js?

    I ask this because in the browser console if I enter in one of the constants it comes up as undefined.

    thanks

  6. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    9
    Answers
    1
    Vote Rating
    0
    lex_won is on a distinguished road

      0  

    Default


    bump

    Can anyone elaborate on what happens to global variables during the production build process?

    thanks

  7. #6
    Sencha User
    Join Date
    Mar 2012
    Location
    The Netherlands
    Posts
    75
    Answers
    13
    Vote Rating
    4
    SebasSP is on a distinguished road

      0  

    Default


    A singleton class might help you:
    http://www.sencha.com/forum/showthre...obal-Variables

  8. #7
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    498
    Answers
    25
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    I don't know how much this helps.... but I have previously discovered that code in the global scope executes in a different order after minimization.

    The reason for this is that Sencha Command builds the single app.js file so that the Ext.Application call is right at the bottom. Usually it would be the first code executed; after a production build it's essentially the last (in the global scope at least).

    My bet is that your ID strings are therefore in the minimized file being set too late, and you're trying to reference them before they're set perhaps? So no element is found when you try to get an element with a null ID.

  9. #8
    Sencha User
    Join Date
    Sep 2011
    Posts
    9
    Answers
    1
    Vote Rating
    0
    lex_won is on a distinguished road

      0  

    Default


    shepsii,

    That was exactly what was happening - the way the build was happening the constants were not even being loaded.

    Rather than using a singleton class as was suggested (it would have require a major refactoring effort to change how the constants were being called) I created a constants.js file that I included from the index.html side so that those variables are not minified as part of the build process.

    I can get the application to load properly in the production build format now

    thanks!

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi