PDA

View Full Version : Error while building using sencha command to production



shuchia
17 Apr 2012, 12:00 PM
Hi,
I am trying to run a sencha touch 2 production build. I changed my index.html to point from sdk/microloader/development.js to sdk/microloader/testing.js.
If i run the sencha app build -e testing command with index.html pointing to testing.js or production.js it errors out.
sdk/microloader/development.js
[INFO] Resolving your application dependencies...
[ERROR] Error thown from your application with message: TypeError: 'undefined' i
s not a function

If i point to development.js it works fine. i thought the only difference between development and production is minifying and obsfuscation as well generating cache.manifest.
Am i missing something? I have dependencies on a couple of javascript files which I have listed in order in app.json. Please help!!!:((

estesbubba
17 Apr 2012, 1:41 PM
I don't think you want to modify the microloader in your development index.html. We I run production build it puts a new index.html in the builds folder with the inline production microloader.

shuchia
18 Apr 2012, 5:38 AM
Hi,
Thanks for your feedback. I tried with index.html still pointing to development.js and running the build, this time it does resolve the dependencies but it does not generate the index.html or the cache.manifest files.
Here is the console output.
[INFO] Minified resources/css/icons.css
[INFO] Minified resources/css/app.css
[INFO] Minified resources/css/icons-hi-dpi.css
[INFO] Minified resources/css/loading.css
[INFO] Minified resources/css/disclosure_styles.css
[INFO] Generated delta for: 'app/util/I18nUtil.js' from hash: 'e8500f8e88348cc44
e78718b28d9c399b88caa09' to hash: '78a7f5b4418505e2561f27c74f9e9e6aa9933233'
[INFO] Generated delta for: 'resources/css/app.css' from hash: '043f600a2265973d
f734539f5e2f54e4b5618526' to hash: '3b78fd180679d43a331e952e5999a5954f948498'
[INFO] Minified app.js
[INFO] Generated delta for: 'app.js' from hash: '7030ae545da557202c5989edbd71649
663f62789' to hash: 'b22ece90bd8246546bcc3f22ab7655235017bb61'
[INFO] Generated delta for: 'app.js' from hash: 'e12e7b8c183568b23a74acdb53d7816
e2cdc9c99' to hash: 'b22ece90bd8246546bcc3f22ab7655235017bb61'
[INFO] Minified resources/css/sencha-touch.css
But the generated folder does not contain the index.html or cache manifest.

shuchia
18 Apr 2012, 8:39 AM
If I keep the reference to development.js then the production build runs fine but does not generate these last steps
Generated app.json

Embedded microloader into index.html

[I][INFO] Generating checksum for appCache item: index.html

[I][INFO] Generated cache.manifest

Jacky Nguyen
20 Apr 2012, 11:53 AM
What's the content of your app.json?

shuchia
20 Apr 2012, 11:59 AM
{
/**
* The application's namespace, used by Sencha Command to generate classes
*/
"name": "bh",
"ignore":[
".svn"
],


/**
* List of all JavaScript assets in the right execution order.
* Each item is an object with the following format:
* {
* "path": "path/to/script.js" // Relative path to this app.json file
* "update": "delta" // (Optional)
* // - If not specified, this file will only be loaded once, and
* // cached inside localStorage until this value is changed.
* // - "delta" to enable over-the-air delta update for this file
* // - "full" means full update will be made when this file changes
*
* }
*/
"js": [


{
"path": "sdk/sencha-touch.js"
},
{
"path": "lib/sencha-touch-2/sencha-touch-debug.js"

},
{
"path": "lib/l10n.js",
"update": "delta"


},
{
"path": "app/util/I18nUtil.js",
"update": "delta"


},
{
"path": "lib/webkit/WebKitDetect.js",
"update": "delta"

},
{
"path": "lib/browser/BrowserDetect.js",
"update": "delta"

},
{
"path": "app/conf/conf.js",
"update": "delta"

},
{
"path": "lib/datejs/date-en-us.js",
"update": "delta"


},
{
"path": "app/i18n/localizations.json",
"update": "delta"

},
{
"path": "app/i18n/en.json",
"update": "delta"

},
{
"path": "app/i18n/es.json",
"update": "delta"

},
{
"path": "lib/Currency.js",
"update": "delta"

},
{
"path": "lib/infobubble.js",
"update": "delta"

},
{
"path": "app.js",
"update": "delta"
}
],


/**
* List of all CSS assets in the right inclusion order.
* Each item is an object with the following format:
* {
* "path": "path/to/item.css" // Relative path to this app.json file
* "update": "delta" // (Optional)
* // - If not specified, this file will only be loaded once, and
* // cached inside localStorage until this value is changed to either one below
* // - "delta" to enable over-the-air delta update for this file
* // - "full" means full update will be made when this file changes
*
* }
*/
"css": [
{
"path": "resources/css/app.css",
"update": "delta"
},
{
"path": "resources/css/sencha-touch.css",
"update": "delta"
},
{
"path": "resources/css/loading.css",
"update": "delta"
},
{
"path": "resources/css/icons.css",
"update": "delta"
},
{
"path": "resources/css/icons-hi-dpi.css",
"update": "delta"
},
{
"path": "resources/css/disclosure_styles.css",
"update": "delta"
}
],


/**
* Used to automatically generate cache.manifest (HTML 5 application cache manifest) file when you build
*/
"appCache": {
/**
* List of items in the CACHE MANIFEST section
*/
"cache": [
"index.html"
],
/**
* List of items in the NETWORK section
*/
"network": [
"*"
],
/**
* List of items in the FALLBACK section
*/
"fallback": []
},


/**
* Extra resources to be copied along when build
*/
"extras": [
"resources/images",
"resources/icons",
"resources/loading"
],


/**
* Directory path to store all previous production builds. Note that the content generated inside this directory
* must be kept intact for proper generation of delta between updates
*/
"archivePath": "archive",


/**
* Default paths to build this application to for each environment
*/
"buildPaths": {
"testing": "build/testing",
"production": "build/production",
"package": "build/package",
"native": "build/native"
},


/**
* Build options
*/
"buildOptions": {
"product": "touch",
"minVersion": 3,
"debug": true,
"logger": "yes"
},


/**
* Uniquely generated id for this application, used as prefix for localStorage keys.
* Normally you should never change this value.
*/
"id": "4962d120-83ce-11e1-8181-9fb1009b5ae7"
}

shuchia
20 Apr 2012, 12:12 PM
Where do I specify the json files then?
Thanks a lot

Jacky Nguyen
20 Apr 2012, 12:13 PM
I saw that you listed a bunch of .json files inside the "js" array, which obviously won't work. Take those out and try again. Paste the whole output here if it still doesn't work.

Jacky Nguyen
20 Apr 2012, 12:36 PM
Since they're raw JSON content, usually the client has to retrieve them via XHRs. There's no need to list them out at all inside app.json. However this leads to multiple extra requests every time your application is loaded. You could write your own code to store them inside Local Storage upon first load. This is fairly easy to do, just not a built-in feature.

shuchia
23 Apr 2012, 6:41 AM
Hi jacky,
I have one last question, is it possible to load all the javascript using a URL. We have to host all out javascript/css and images on the cloud while our index.html has to be on an inhouse webserver.
Thanks
shuchi.