How do I add implicit requires to a set of AMD files?
I'm porting some code from a bower-managed app to a play, webjars app. The original app has several places that use jquery ($), but do not declare jquery in the define
block. How does this happen? How can I do it in my new app?
The code I'm porting looks like:
define(['underscore',
'backbone',
'text!./html/my-view.html'],
function(_,
mvc,
myView) {
'use strict';
...
return {
render: function() {
var el = this.el;
$(el).html(myView);
...
Require js is probably loading Jquery before you define this module. Backbone.Views has a dependency on Jquery, so without jquery , your views will not work. Try to find the main module of this app that you're using and there you will figure out how requireJs loads Jquery.
Backbone has this piece of code. Which shows his dependency on Jquery.
// Current version of the library. Keep in sync with `package.json`.
Backbone.VERSION = '1.1.2';
// For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
// the `$` variable.
Backbone.$ = $;