Created
February 1, 2013 03:43
-
-
Save mkuklis/4689023 to your computer and use it in GitHub Desktop.
requirejs + cordova
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require.config({ | |
| dir: "../../release/js/", | |
| optimize: "uglify", | |
| paths: { | |
| jquery: 'vendor/jquery/jquery-1.9.0', | |
| underscore: 'vendor/underscore', | |
| backbone: 'vendor/backbone/backbone', | |
| text: 'vendor/require/plugins/text', | |
| cordova: 'vendor/android/cordova-2.3.0' | |
| }, | |
| shim: { | |
| underscore: { | |
| exports: '_' | |
| }, | |
| backbone: { | |
| deps: ["underscore", "jquery"], | |
| exports: "Backbone" | |
| }, | |
| cordova: { | |
| exports: 'cordova' | |
| }, | |
| app: { | |
| deps: ['jquery', 'underscore', 'backbone', 'cordova'] | |
| } | |
| } | |
| }); | |
| require(['app'], function (App) { | |
| document.addEventListener('deviceready', function () { | |
| App.initialize(); | |
| }, false); | |
| }); |
Author
Yeah, me either but they're working well. Seems like a decent compromise.
On a side note...really wish there were notifications for Gists.
Author
Ha I was just thinking the same (regarding gists :)). I will give it a try with the hooks as well. I'm glad you found them.
Tracing dependencies for: main
Error: ENOENT, no such file or directory './app/vendor/cordova/channel.js'
In module tree:
main
cordova
the above problem solution
require.config({
shim: {
'cordova-android': {
exports: 'cordova'
}
},
paths: {
// don't map cordova.js with path 'cordova',
// because it conflicts with internal module named 'cordova' in cordova.js.
// if you map path 'cordova' with cordova-2.6.js, when it exec require('cordova/channel'),
// will load script from cordova-2.6/channel.js,
// because 'cordova' = 'cordova-2.6' with the path setting.
// http://stackoverflow.com/questions/15440529/cordova-2-4-0-or-2-5-0-or-2-6-0-and-requirejs
'cordova-android': '../lib/cordova-2.6.0'
}
});
do you know how to do with phonegap 3.5(not cordova 3.5 ) and rquireJs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oh didn't realize these hooks exist. This doesn't look too bad. Does it work for you?