1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default Sencha Build: Production version causes error, Testing version works fine

    Sencha Build: Production version causes error, Testing version works fine


    I have a working testing build running, but when I create a production version, its build fine with no errors. However when I run in the browser I see this in the console:

    Code:
    Document was loaded from Application Cache with manifest http://localhost/pptouch/build/produ...cache.manifest
    Application Cache Checking event
    Application Cache NoUpdate event
    Error evaluating http://localhost/pptouch/build/production/app.js with message: ReferenceError: HistoryMarkerManagerInit is not defined   index.html:71
    

    The 'HistoryMarkerManagerInit' the error refers is located in a script file which should be being loaded in before my app.js file is as its called in the launch function. I don't see this file being loaded in however when I look at the Network tab in Chrome debugging tools. This is no doubt down to my lack of understanding of what the production build is actually doing with my application!

    Do I need to change something in my app.json config file before running the production build? I notice that in the config file is a section called 'appCache' and I see index.html is in a 'cache' array definition. Do I need my script references added in here too?

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,047
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Before you did the build, is the file for the HistoryMarkerManagerInit loaded via a <script> tag or is it required via Ext.require or the like?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Well, the file is not included using a script tag or using a require.

    I have some additional script files in my app.json file configured like so:

    Code:
    "js": [
            {
                "path": "sdk/sencha-touch.js"
            },
     
            {
                "path": "Lib/markerwithlabel_packed.js",
                "update": "delta"
            },
            {
                "path": "Lib/markermanager-min.js",
                "update": "delta"
            },
            {
                "path": "Scripts/SBS.HistoryMarkerManager.js",
                "update": "delta"
            },
            {
                "path": "app.js",
                "update": "delta"
            }
        ]
    The built testing version of the application loads these script files in the browser.

    This wouldn't have anything to to with Ext.loader not being enabled in my application would it? Only, I generated my application structure using the Sencha command, and I see at the top of the app.js file that's created I have:

    Code:
    //<debug>
    
    
    Ext.Loader.setPath({
        'Ext': 'sdk/src'
    });
    //</debug>
    I dont see:

    Code:
    Ext.Loader.setConfig({
        enabled: true
    });
    which I do have in a version of my app.js which I wrote before the Sencha command tools were out for us to use.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,047
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Ext.Loader should not be used to load files dynamically in production. In your development the file is loaded via a require method?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Im not using Ext.Loader anywhere in my code.

    Before I answer your question, can you answer these for me...

    When does the app.json file in the root of the directory (which gets generated from the sencha create command) get used? Should it only ever get used for build procedures via the sencha command?

    Only when I look at my generated index file in the root of my working directory I have no script includes to my own script files so SBS.HistoryMarkerManager.js for example.

    The only place I have a reference to this is in the js entries of the app.json file.

    If I comment them out, I get undefined related script errors in the local version of my application. I thought this app.json file is only used for production purposes (according to the docs that is)

    Thanks

  6. #6
    Sencha User Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469
    Vote Rating
    14
    Jacky Nguyen has a spectacular aura about Jacky Nguyen has a spectacular aura about

      0  

    Default


    Quote Originally Posted by parky128 View Post
    Im not using Ext.Loader anywhere in my code.

    Before I answer your question, can you answer these for me...

    When does the app.json file in the root of the directory (which gets generated from the sencha create command) get used? Should it only ever get used for build procedures via the sencha command?

    Only when I look at my generated index file in the root of my working directory I have no script includes to my own script files so SBS.HistoryMarkerManager.js for example.

    The only place I have a reference to this is in the js entries of the app.json file.

    If I comment them out, I get undefined related script errors in the local version of my application. I thought this app.json file is only used for production purposes (according to the docs that is)

    Thanks
    app.json is used for development, as well as all the builds, so you're doing it correctly. It's the only one place to list out all assets to be loaded with your app.

    First off, delete the 'archive' directory, and clear localStorage in your browser (as simple as running localStorage.clear() on the debugger's console).

    Try 'sencha app build package' and run the package build on your browser to see if you have the same error.

    Also, see if the files are actually loaded by do something like adding a "console.log('...')" (don't use alert(...)) at the end of each file, i.e: Lib/markerwithlabel_packed.js, Lib/markermanager-min.js, Scripts/SBS.HistoryMarkerManager.js. If you see the logs for all three, then it's more likely a run-time issue instead of loading issue.

    Let me know the results, I'll follow up.
    Sencha Touch Lead Architect

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Thanks Jacky,

    I tried localStorage.clear() and it returns 'undefined' in the console. I can get to the localStorage object in the console (I am using Chrome by the way) and can see the clear function if I inspect the object.

  8. #8
    Sencha User Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469
    Vote Rating
    14
    Jacky Nguyen has a spectacular aura about Jacky Nguyen has a spectacular aura about

      0  

    Default


    localStorage.clear() doesn't return anything so it's totally correct that you see "undefined" on the console. Have you tried the next 2 steps?
    Sencha Touch Lead Architect

  9. #9
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Jacky,

    Just following up on where we left off on this, I know it was some time ago!

    Anyway, I have gone through the steps you have suggested and the package version of the build runs fine for me and I can see my console.log() outputs in the debugger.

    The problems still remains for me in this production build where I get the error as stated in my first post on this thread.

  10. #10
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    25
    Vote Rating
    0
    echobloom is on a distinguished road

      0  

    Default


    I've got this exact same problem - any resolution on this?