Reputation:
I am getting errors in console. Can you help me fix it.
I have included requirejs
and necessary backbone libraries.
My code
require.config({
paths : {
backbone : '//jashkenas.github.io/backbone/backbone-min.js',
underscore : '//jashkenas.github.io/underscore/underscore-min.js',
jquery : '//code.jquery.com/jquery-2.1.1.min.js',
marionette : 'http://marionettejs.com/downloads/backbone.marionette.min.js'
},
shim : {
jquery : {
exports : 'jQuery'
},
underscore : {
exports : '_'
},
backbone : {
deps : ['jquery', 'underscore'],
exports : 'Backbone'
},
marionette : {
deps : ['jquery', 'underscore', 'backbone'],
exports : 'Marionette'
}
}
});
Upvotes: 0
Views: 138
Reputation: 3006
First, you don't need to add backbone,jquery and other library's script tag in html, since you already include them using requirejs api. Second, it's recommended that you put your define code in a single file, or you should give it a name.
More info, see here: http://requirejs.org/docs/errors.html#mismatch
Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them.
If you manually code an HTML script tag, be sure it only includes named modules, and that an anonymous module that will have the same name as one of the modules in that file is not loaded.
Upvotes: 1