-
-
Save mkuklis/4689023 to your computer and use it in GitHub Desktop.
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); | |
}); |
Oh I see that's pretty sad :(. It's crazy that they define their own define/require. Their code is pretty messy too...
I just ran this:
:%s/define(/cordova_define(/g
:%s/require/cordova_require/g
in vim to replace the names. that seems to make r.js happy but not sure if I like it...
I think other than that you are right the only option is to load it outside of require :(
Gah! That's no fun. This might be a little better: requirejs/r.js#170 (comment)
Thanks again for taking time to help with this.
oh didn't realize these hooks exist. This doesn't look too bad. Does it work for you?
Yeah, me either but they're working well. Seems like a decent compromise.
On a side note...really wish there were notifications for Gists.
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
My setup is very similar. I'm getting this when I try to build with Grunt/r.js:
Which I believe is happening because cordova.js has an internal module system that's calling
require('cordova/channel')
. Not really sure what to do except load cordova.js separately (outside of RequireJS).