Created
November 26, 2012 20:43
-
-
Save ox/4150501 to your computer and use it in GitHub Desktop.
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
// the module needs to be `define`'d. If the `require([])` syntax is used, then the async method NEEDS to be used. | |
define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) { | |
console.log("running the app..."); | |
var initialize = function(){ | |
// Pass in our Router module and call it's initialize function | |
console.log("initializing from inside the app"); | |
}; | |
return { | |
initialize: initialize | |
}; | |
}); |
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({ | |
paths: { | |
jquery: 'libs/jquery', | |
underscore: 'libs/underscore', | |
backbone: 'libs/backbone' | |
}, | |
shim: { | |
backbone: { | |
deps: ['underscore', 'jquery'], | |
exports: 'Backbone' | |
} | |
} | |
}); | |
require(['app'], function(App) { | |
console.log("requiring app"); | |
App.initialize(); | |
}); |
Are you sure that you have the proper AMD versions of backbone and underscore? I remember seeing something similar using the stock versions of the libraries.
Try: https://github.com/amdjs/underscore and https://github.com/amdjs/backbone
The solution involves this: http://requirejs.org/docs/errors.html#notloaded. The code changes should make it seem obvious
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try channging the exports for the backbone shim to 'backbone' instead of 'Backbone'