Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Module name "jquery" has not been loaded yet for context: _. Use require([]) #41

Open
mauron85 opened this issue May 23, 2013 · 6 comments

Comments

@mauron85
Copy link

Hi.

I'm using grunt to build my project.
When I concat all requirejs files (all libraries and classes) using requirejs optimizer (r.js) I get error:
Module name "jquery" has not been loaded yet for context: _. Use require([])

According to http://requirejs.org/docs/errors.html#notloaded
error is caused by backbone.iobind and backbone.iosync Common JS require because there is is a require('name') call, but the 'name' module has not been loaded yet:

  // Common JS // require JS
  var _, $, Backbone, exports;
  if (typeof window === 'undefined' || typeof require === 'function') {
    $ = require('jquery');
    _ = require('underscore');
    Backbone = require('backbone');
    exports = Backbone;
    if (typeof module !== 'undefined') module.exports = exports;
  } else {
    $ = this.$;
    _ = this._;
    Backbone = this.Backbone;
    exports = this;
  }

I also declared dependencies in requirejs config to make backbone.iobind dependend on jquery, underscore and backbone, what in theory should solve loading problems, but it didn't.

But when I remove block completely, it works both in nonconcated project and also builded project.

So my quesion is can it be just removed also in git hub repos?

Version of libraries I'm using:

"requirejs": "~2.1.4",
"jquery": "~1.9.0",
"jquery-mobile": "1.3.1",
"underscore": "~1.4.3",
"backbone": "~1.0.0",
"backbone.iobind": "*"

@mauron85
Copy link
Author

Sorry it looks like it's duplicate of #40

@mahnunchik
Copy link
Contributor

see #40 (comment)

@ghost
Copy link

ghost commented Aug 6, 2013

I have this same issue, what is the solution for it? I see that in #40 he closed the pull request?

@Puigcerber
Copy link
Contributor

I'm having the same issue after concatenating all the files using Grunt.

@temp3l
Copy link

temp3l commented Dec 13, 2013

same here

@mahnunchik
Copy link
Contributor

Hi, could you please check this solution in last commit: 4ceee9d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants