Results 1 to 5 of 5

Thread: App using a package tries loading packaged controller and view from build directory

  1. #1
    Sencha User
    Join Date
    May 2015
    Posts
    31

    Default App using a package tries loading packaged controller and view from build directory

    Hello,

    when building an app that uses a package, parts of the package that are controllers, views or stores are attempt to be loaded from the build dir.


    Sencha Cmd Version: Sencha Cmd v5.1.2.52
    Touch version: GPL Version of Sencha Touch version 2.4.1.527
    OS: Windows 7 64Bit
    Java: Java(TM) SE Runtime Environment (build 1.7.0_67-b01), Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

    Steps to reproduce the issue (example uses a view, same happens to controller, stores and models)

    // create workspace
    PHP Code:
    sencha generate workspace D:\DEVEL\Senchatest
    //copy touch into the workspace in D:\DEVEL\Senchatest\touch

    // setup app
    PHP Code:
    sencha -sdk D:\DEVEL\Senchatest\touch generate app MyApp D:\DEVEL\Senchatest\MyApp 
    // initial build
    PHP Code:
    cd MyApp
    sencha app build 
    // Test with browser using microloader in app - OK
    PHP Code:
    http://localhost/Senchatest/MyApp 
    // Test with browser using production built in app - OK
    PHP Code:
    http://localhost/Senchatest/build/production/MyApp/ 
    // adding package
    PHP Code:
    cd D:\DEVEL\Senchatest\
    sencha generate package MyPackage 
    // adding package to app.json in /MyApp
    PHP Code:
       /**
         * List of package names to require for the cmd build process
         */
        
    "requires": [
            
    'MyPackage'
        
    ], 
    // creating a view in the package
    // D:\DEVEL\Senchatest\packages\MyPackage\src\view \Test.js
    PHP Code:
    Ext.define("MyPackage.view.Test", {
        
    extend"Ext.Panel"
        
    ,requires: [
            
    "Ext.Panel"
        
    ]
        ,
    alias"widget.test"
            
        
    ,config: {
            
    title'Testpanel'
            
    ,html'My test panel from package'
        
    }
    }); 
    // add panel to sample app in MyApp/app.js
    PHP Code:
    Ext.application({
        
    name'MyApp',
        
    requires: [
            
    'Ext.MessageBox''MyPackage.view.Test'
        
    ],

        
    views: [
            
    'Main''Test'
        
    ], 
    //build app again
    PHP Code:
    sencha app build 
    // Test again - we do not actually use the view, just added it
    // Test with browser using microloader in app - 404
    PHP Code:
    http://localhost/Senchatest/MyApp
    404 http://localhost/Senchatest/MyApp/app/view/Test.js?_dc=1431107585077 
    // Test with browser using production built in app - 404
    PHP Code:
    http://localhost/Senchatest/build/production/MyApp/
    404 http://localhost/Senchatest/build/production/MyApp/app/view/Test.js?_dc=1431107664947 
    //Ok - try using the full package name in app.js
    PHP Code:
    Ext.application({
        
    name'MyApp',

        
    requires: [
            
    'Ext.MessageBox''MyPackage.view.Test'
        
    ],

        
    views: [
            
    'Main''MyPackage.view.Test' // <-- full name
        
    ], 
    //build app again
    PHP Code:
    sencha app build 
    // Test again ...
    // Test with browser using microloader in app - OK
    PHP Code:
    http://localhost/Senchatest/MyApp 
    // Test with browser using production built in app - 404
    PHP Code:
    http://localhost/Senchatest/build/production/MyApp/
    404 http://localhost/Senchatest/build/production/MyApp/app/view/MyPackage/view/Test.js?_dc=1431108096688 
    Again, the same happens to me for controller and stores.
    I am sure i am missing something. But reading the docs carefully, using goggle and stackoverflow, i have not found a solution.
    So any comment is welcome...

    Best regards

    Wolfgang

    P.S.: The boosttrap seems fine. It reference the view in the package...

    PHP Code:
    Ext.Loader.addClassPathMappings({
      
    "Ext""../touch/src",
      
    "Ext-more""../touch/src/core/Ext-more.js",
      
    "Ext.Boot"".sencha/app/Boot.js",
      
    "Ext.DomHelper""../touch/src/dom/Helper.js",
      
    "Ext.DomQuery""../touch/src/dom/Query.js",
      
    "Ext.Element-alignment""../touch/src/dom/Element.alignment.js",
      
    "Ext.Element-all""../touch/src/dom/Element.traversal.js",
      
    "Ext.Element-insertion""../touch/src/dom/Element.insertion.js",
      
    "Ext.Element-position""../touch/src/dom/Element.position.js",
      
    "Ext.Element-static""../touch/src/dom/Element.static.js",
      
    "Ext.Element-style""../touch/src/dom/Element.style.js",
      
    "Ext.Element-traversal""../touch/src/dom/Element.traversal.js",
      
    "Ext.core.DomQuery""../touch/src/dom/Query.js",
      
    "Ext.device.Purchases.Product""../touch/src/device/purchases/Sencha.js",
      
    "Ext.device.filesystem.DirectoryEntry""../touch/src/device/filesystem/Sencha.js",
      
    "Ext.device.filesystem.Entry""../touch/src/device/filesystem/Sencha.js",
      
    "Ext.device.filesystem.FileEntry""../touch/src/device/filesystem/Sencha.js",
      
    "Ext.device.filesystem.FileSystem""../touch/src/device/filesystem/Sencha.js",
      
    "Ext.device.purchases.Purchase""../touch/src/device/purchases/Sencha.js",
      
    "Ext.device.sqlite.Database""../touch/src/device/sqlite/Sencha.js",
      
    "Ext.device.sqlite.SQLResultSet""../touch/src/device/sqlite/Sencha.js",
      
    "Ext.device.sqlite.SQLResultSetRowList""../touch/src/device/sqlite/Sencha.js",
      
    "Ext.device.sqlite.SQLTransaction""../touch/src/device/sqlite/Sencha.js",
      
    "Ext.draw.engine.SvgContext.Gradient""../touch/src/draw/engine/SvgContext.js",
      
    "MyApp""app",
      
    "MyPackage.view.Test""../packages/MyPackage/src/view/Test.js"
    }); 

  2. #2
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,748

    Default

    I believe this is an issue in Sencha Touch the "views", "controllers" etc configs do not properly respect root namespaces.

    You might try:

    Code:
       //<debug>
       Ext.Loader.setPath('MyPackage', '../packages/MyPackage/src');
       //</debug>
    That should not be needed to inform the Loader, but the MVC components look at registered namespaces in the Loader to help them decide if a name is fully qualified.
    Don Griffin

    "Use the source, Luke!"

  3. #3
    Sencha User
    Join Date
    May 2015
    Posts
    31

    Default Works with a minor change

    Thank you ;-)

    Did not work with <debug>. But leaving out //<debug> helped.

    I did not find infos about <debug>.
    My guess is thats a conditional for the build process. So i tried without <debug> and with <production> instead.
    Both worked.

    Test details:

    // NOK - add explicit loader statement to app.js - with <debug> same as before
    PHP Code:
    //<debug>
        
    Ext.Loader.setPath('MyPackage''../packages/MyPackage/src'); // <- added with <debug>
    //</debug>
    Ext.application({
        
    name'MyApp',

        
    requires: [
            
    'Ext.MessageBox''MyPackage.view.Test'
        
    ],

        
    views: [
            
    'Main''MyPackage.view.Test'
        
    ], 
    // OK - add explicit loader statement to app.js - without <debug>
    PHP Code:
    Ext.Loader.setPath('MyPackage''../packages/MyPackage/src'); // <- added without <debug>
    Ext.application({
        
    name'MyApp',

        
    requires: [
            
    'Ext.MessageBox''MyPackage.view.Test'
        
    ],

        
    views: [
            
    'Main''MyPackage.view.Test'
        
    ], 
    // OK - Assuming <debug> is a conditional for the build target. Lets try <production>
    PHP Code:
    //<production>
        
    Ext.Loader.setPath('MyPackage''../packages/MyPackage/src'); // <- added with <production>
    //</production>
    Ext.application({
        
    name'MyApp',

        
    requires: [
            
    'Ext.MessageBox''MyPackage.view.Test'
        
    ],

        
    views: [
            
    'Main''MyPackage.view.Test'
        
    ], 
    So again thank you!

    P.S.:
    - Is this a bug in sencha cmd?
    - Would it harm to add a Ext.Loader.setPath() to any app.js as a failsafe?

  4. #4
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,748

    Default

    The //<debug> tag is used in non-production builds (so development and testing). It predates Sencha Cmd so was preserved. There is no //<production> processor so that block will simply be retained (comment ignored).
    Don Griffin

    "Use the source, Luke!"

  5. #5
    Sencha User
    Join Date
    May 2015
    Posts
    31

    Default Solved

    Thank you for explanation :-)

Similar Threads

  1. Loading controller on other package.
    By k_cire0426 in forum Ext: Q&A
    Replies: 2
    Last Post: 3 Dec 2013, 10:48 PM
  2. Replies: 1
    Last Post: 24 Sep 2013, 10:31 AM
  3. Sencha Package: The packaged application is not working
    By sridhar.boganathan in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 13 Jun 2013, 6:49 AM
  4. Replies: 2
    Last Post: 16 Dec 2012, 1:57 AM
  5. Replies: 2
    Last Post: 19 Aug 2012, 12:01 PM

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
  •