-
20 Feb 2012 10:41 AM #1
Answered: Using the build tool I get: Uncaught ReferenceError: Ext is not defined
Answered: Using the build tool I get: Uncaught ReferenceError: Ext is not defined
Hi guys, I am currently trying to create a production build for my app.
Doing my best to follow the steps in http://docs.sencha.com/touch/2-0/#!/guide/building
(If i do follow it exactly, it breaks on the "sencha build" step because the app.js path in my generated app.jsb3 file is incorrect)
First I go to the root directory of my app (where index.html is found) and run:
Once the app.jsb3 file is created I have to edit the path entry for my app.js file:Code:sencha create jsb -a http://localhost/touchcatalog/ -p app.jsb3
from:
to:Code:{ "name": "Application - Production", "target": "app-all.js", "compress": true, "files": [ { "path": "", "name": "all-classes.js" }, { "path": "", "name": "app.js" } ] }
then I run:Code:{ "name": "Application - Production", "target": "app-all.js", "compress": true, "files": [ { "path": "", "name": "all-classes.js" }, { "path": "app/", "name": "app.js" } ] }
Here is my production index.html:Code:sencha build -p app.jsb3 -d ./
here is my app.js:Code:<!DOCTYPE html><html> <head> <title>Catalog</title> <link rel="stylesheet" href="resources/css/sencha-touch.css" type="text/css"> <style> .productlistitem img{ height: 60px; } .productpageitem img{ height: 150px; } .productpagedetail img{ height: 250px; } .animation_frame { width:100%; height:100%; } } </style> <script type="text/javascript" src="app-all.js"></script> </head> <body></body> </html>
When I hit it in my browser I get "Uncaught ReferenceError: Ext is not defined"Code:(function() { Ext.Loader.setConfig({ enabled: true }); Ext.Loader.setPath('Myapp', 'app'); Ext.require(['Myapp.store.CategoriesStore', 'Ext.data.proxy.JsonP', 'Ext.TitleBar', 'Myapp.view.catalog.ProductPager', 'Myapp.store.ProductsStore', 'Myapp.Config', 'Myapp.view.ViewPort', 'Myapp.view.flyer.FlyerPager', 'Ext.field.Password', 'Myapp.store.VideoStore', 'Myapp.view.videos.VideoDetail', 'Ext.Video']); Ext.application({ name: 'Myapp', controllers: ['Myapp.controller.MainController', 'Myapp.controller.catalog.MainCatalogController', 'Myapp.controller.catalog.ProductCatalogController'], models: ['CategoryModel', 'ProductModel'], stores: ['CategoriesStore', 'ProductsStore', 'Myapp.store.VideoStore'], views: ['ViewPort', 'Myapp.view.catalog.CategoryNestedList', 'Myapp.view.catalog.ProductView', 'Myapp.view.catalog.ProductViewToggle', 'Myapp.view.catalog.ProductList', 'Myapp.view.catalog.ProductPage', 'Myapp.view.catalog.ProductPanel', 'LoginForm', 'AuthenticationIndicator', 'Myapp.view.catalog.CatalogView', 'Myapp.view.flyer.FlyerPager', 'Myapp.view.videos.VideoDetail'], launch: function() { Ext.create('Myapp.view.ViewPort'); return this.fireEvent('applaunch'); } }); }).call(this);
Not sure how to get this working, any suggestions?
-
Best Answer Posted by mitchellsimoens
You still need to reference sencha-touch.js
-
20 Feb 2012 11:07 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3161
You still need to reference sencha-touch.js
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Feb 2012 11:08 AM #3
oh yeah... im using beta3 ,version 2 of the sdk tools, and sencha-touch-debug.js inside my development index.html file
-
20 Feb 2012 11:11 AM #4
With sencha-touch.js included, I get this error:
Uncaught Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically.
-
20 Feb 2012 11:27 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3161
That means not all your files made it into the build.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Feb 2012 11:33 AM #6
ahh! that makes sense. thx, i will go through my jsb3 file and try to figure it out.
Any idea why the sencha create command would have missed something? Is there something I can do on my end to ensure that it doesn't?
(Im going to start by re-organizing my dependencies.... try to move them out of app.js and get my "requires" in the files where they actually need to go)
-
20 Feb 2012 11:45 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3161
You have to be very careful that you put all your classes in the requires or views or controllers config arrays. If you want to know what classes aren't being included you can use sencha-touch-debug.js which has Loader enabled and you can watch the network tab to see what classes are still being loaded and also use the app-all.js file not your app.js.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote