Results 1 to 2 of 2

Thread: External dependencies not included in sencha app build native

  1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    40
    Answers
    1

    Default Answered: External dependencies not included in sencha app build native

    I have setup External Dependencies for my Cordova Sencha app as per the Sencha docs http://docs.sencha.com/touch/2.4/cor...ncies_mvc.html


    ie. so I set the path to the files in my Auth folder which sits alongside the app folder
    Ext.Loader.setPath({
    'Auth': 'Auth'
    });

    And I then define my dependencies:
    Ext.application({
    views: ['Auth.view.LoginForm', 'Welcome'],
    controllers: ['Auth.controller.Sessions', 'Main'],
    models: ['Auth.model.User']
    });


    In development mode this works fine. However when I build (ie. sencha app build native), it builds without errors, but when I run the app it hangs (I get a bunch of chromium errors). Examining the obfuscated app.js shows that the external dependences haven't been included. Presumably the app hangs when it tries to load the dependencies that aren't there.

    I'm doing everything the Sencha docs say but it's not working. I'm using the latest versions of Sencha CMD and Sencha SDK.


    So how do I get Sencha built (ie. sencha app build native) to include my external dependencies in app.js?

    Any help would be appreciated.

  2. This forum continues to disappoint me; the only responses I ever receive are my own. Anyway, for anyone else that runs into the same problem, the solution that worked for me is included below. For what it's worth though I'd also like to make the point that the Sencha documentation needs to be improved so mugs like me don't lose days of work on relatively trivial issues like this. Specifically, the External Dependencies section of Managing Dependencies with MVC in the Sencha Documentation (http://docs.sencha.com/touch/2.4/cor...ncies_mvc.html) should include a side note detailing the configuration changes that need to be made to get external dependencies working with sencha build. I doubt anyone will read this or that anything will change, but I feel somewhat better for having said it anyway.

    OK, so to get external class dependencies working with Sencha build you need to add the path to your classpath variable in .sencha/app/sencha.cfg eg.
    app.classpath=${app.dir}/Auth,${app.dir}/app,${app.dir}/app.js

    NOTE: I think the order your paths are declared in might be important here. I tried this before with the path appended to the end and it didn't work.

    Also, in your app.js make sure your paths are not set inside debug tags - when I tried it like this it didn't work
    //<debug>
    Ext.Loader.setPath({
    'Auth': 'Auth'
    });

    //</debug>

    Good luck, I hope this helps someone out there

  3. #2
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    40
    Answers
    1

    Default Solution

    This forum continues to disappoint me; the only responses I ever receive are my own. Anyway, for anyone else that runs into the same problem, the solution that worked for me is included below. For what it's worth though I'd also like to make the point that the Sencha documentation needs to be improved so mugs like me don't lose days of work on relatively trivial issues like this. Specifically, the External Dependencies section of Managing Dependencies with MVC in the Sencha Documentation (http://docs.sencha.com/touch/2.4/cor...ncies_mvc.html) should include a side note detailing the configuration changes that need to be made to get external dependencies working with sencha build. I doubt anyone will read this or that anything will change, but I feel somewhat better for having said it anyway.

    OK, so to get external class dependencies working with Sencha build you need to add the path to your classpath variable in .sencha/app/sencha.cfg eg.
    app.classpath=${app.dir}/Auth,${app.dir}/app,${app.dir}/app.js

    NOTE: I think the order your paths are declared in might be important here. I tried this before with the path appended to the end and it didn't work.

    Also, in your app.js make sure your paths are not set inside debug tags - when I tried it like this it didn't work
    //<debug>
    Ext.Loader.setPath({
    'Auth': 'Auth'
    });

    //</debug>

    Good luck, I hope this helps someone out there

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
  •