Results 1 to 2 of 2

Thread: Extjs 4.2.1 + Sencha Cmd 4.0.1 + in dev ok but "undefined" error in production build

  1. #1

    Default Extjs 4.2.1 + Sencha Cmd 4.0.1 + in dev ok but "undefined" error in production build

    I would like to create one file that contains all Urls that my application is using in one seperate file as well as all component text and title strings in some sort of dictionary file.
    When I use a 'url' property, I would like to refer to the 'resources/urls/urlRoutes.js' file and when I use a 'title', I would like to refer to the 'resouces/dictionaries/english.js' file.
    I created a test application by using the command:

    sencha generate app myTestApp c:\data\wamp\www\myTestApp
    and a small english.js file which I've put in the folder:

    resources/dictionaries/english.js
    This english.js file has as content:
    Code:
    Ext.ns("myTestApp.resources.dictionaries.English");
    myTestApp.resources.dictionaries.English.Mask = {
        'MenuItems':{
           'west.text'                  : 'Left'
        }
    };
    I added this english.js file to the index.html file.
    My index.html file looks like this:
    HTML Code:
    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>myTestApp</title>
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <link rel="stylesheet" href="bootstrap.css">
                <script src="ext/ext-dev.js"></script>
                <script src="bootstrap.js"></script>
            <!-- </x-bootstrap> -->
            <script src="app.js"></script>
            <script src="resources/dictionaries/English.js"></script>
        <!-- </x-compile> -->
    </head>
    <body></body>
    </html>
    In the Main.js file of the default generate applidation, I change the line:

    Code:
    {
            region: 'west',
            xtype: 'panel',
            title: 'west',
            width: 150
    }
    into:
    Code:
    {
            region: 'west',
            xtype: 'panel',
            title: myTestApp.resources.dictionaries.English.Mask['MenuItems']['west.text'],
            width: 150
    }
    When I run the program in the development mode, I see the screen with the left panel title 'Left'.
    When I successfully compiled the application with:
    sencha app build
    Then I see an error in firefox console window:
    myTestApp.resources is undefined
    What is going wrong here?
    Do I need to create a package for this?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    You need to load <script src="resources/dictionaries/English.js"></script> before the app.js file as the order you specify the scripts will be the order they will be built in.
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

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
  •