PDA

View Full Version : Script Reference Error in production build only



parky128
17 Apr 2012, 11:26 AM
Hi,

I am encountering a script related error when trying to run my production build version of my application, it builds fine using Sencha Command but when attempting to run in the browser I am seeing this:


Error evaluating http://pptouch.pinpointers.com/build/production/app.js with message: ReferenceError: HistoryMarkerManagerInit is not defined

I don't see this in any other versions of my application (so testing, package) and I also have it build into native iOS and Android apps which run without any problem.

HistoryMarkerManagerInit is a function call within my app.js file in the launch function and is used to initialize a HistoryMarkerManager class which I can then access elsewhere in code.


var HistoryMarkerManagerInit = function() {

HistoryMarkerManager = Ext.extend(Ext.mixin.Observable, {
..rest of code here
});
}

This lives in a HistoryMarkerManager.js file which I am not using in a 'requires' config anywhere in my project, I am only including it in the js config section of the app.json file:


"js": [
{
"path": "sdk-2.0.0-backup/sencha-touch.js",
"update": "delta"
},

{
"path": "Lib/markerwithlabel.js",
"update": "delta"
},
{
"path": "Lib/markermanager.js",
"update": "delta"
},
{
"path": "Scripts/HistoryMarkerManager.js",
"update": "delta"
},
{
"path": "app.js",
"update": "delta"
}
],

Any thoughts on what could be going on here?

Thanks

mitchellsimoens
17 Apr 2012, 11:32 AM
You should use Ext.define not Ext.extend. It shouldn't really be within a function. You are requiring it in app.json but should use Ext.require

parky128
17 Apr 2012, 11:58 AM
Ok, I have followed your advice, so my HistoryMarkerManager class starts like this:


Ext.define('HistoryMarkerManager', {

It's only ever used in a Map view, so in the view definition I now have:


Ext.define('PinpointersTouch.view.GMap', {
extend: 'Ext.Map',
xtype: 'gmap',
requires: [
'HistoryMarkerManager'
],

I have generated a new production build but still I get the same error:


Error evaluating http://pptouch.pinpointers.com/build/productionx/app.js with message: ReferenceError: MarkerManager is not defined

It runs fine in the other non production builds still.

Any ideas?

parky128
18 Apr 2012, 6:45 AM
Hi Mitchell,

Any more thoughts over this that can point me in the right direction?

Thanks