0
votes

I am upgrading my Extjs to 5.0.1 (from 5.0.0 ) and also Sencha Cmd to 5.0.1.231

No compile time errors but on run time it is is not loading the application and giving the following error

Uncaught TypeError: Cannot read property 'baseUrl' of undefined

some other users are having the same issue..

http://www.sencha.com/forum/showthread.php?289872-After-update-to-5.0.1&p=1059537

Is this a bug or we are doing some thing different ?

Thanks

1

1 Answers

3
votes

It looks like a bug, but I think Sencha are pushing towards using a microloader rather than just including the app.js file and the css ones. So my short answer is both! :)

Now the long one:

I was playing with setting up an ExtJS application that is to live far away from the webroot and at the same time to be available in both, development and production modes (environments).

Setting the app.json of the Sencha CMD app, so the microloader.js to load the required js and css files, proved a bit of a challenge.

My folder setup is as per below: (Note, my build folder is outside the Sencha CMD application folder - MyApp - just to have the same path depth)

index.cfm
/far/away/from/web/root
    ....
    /build
        /resources
        app.js
        app.json
        microloader.js
        ...
    /MyApp
        /.sencha
        /ext
        app.json
        app.js
        bootstrap.js
        ....

MyApp/app.json

{
    /**
     * The application's namespace.
     */
    "name": "MyApp",

    /**
     * The relative path to the appliaction's markup file (html, jsp, asp, etc.)
     *
     * Below setting seems relevant for proper loading MyApp/bootstrap.js
     */
    "indexHtmlPath": "../../../../../index.cfm",

    ......

    "output": {
        "base": "${workspace.build.dir}",
        "page": {
            /**
             * Below is relative path from the build folder to the application markup file
             */
            "path": "../../../../../index.cfm",
            "enable": false
        },
        "microloader": {
            "path": "microloader.js",
            "embed": false,
            "enable": true
        },
        "manifest": {
            "path": "app.json",
            "embed": false,
            "enable": "${app.output.microloader.enable}"
        }
    },

    /**
     * Uniquely generated id for this application, used as prefix for localStorage keys.
     * Normally you should never change this value.
     */
    "id": "f6cd3e2b-6a0c-4359-a452-e07adda808ae"
}

Initially, in order to use the production build, was loading directly /far/away/from/web/root/build/app.js file and it throw the same error:

Uncaught TypeError: Cannot read property 'baseUrl' of undefined 

Now, with the app.json configured as per above, I can pick in my index.cfm whether to load:

for production - /far/away/from/web/root/build/microloader.js
for development - /far/away/from/web/root/MyApp/bootstrap.js

I hope this helps someone.

Cheers, Pencho