0

I'm using the latest version of RequireJS and trying to get it to work with jQuery and jQuery plugins.

I can get it to load jQuery fine, but I can't get it to work with jQuery plugins. This is my code:

 var dependencies = ["order!jquery"];
 dependencies = dependencies.concat([
   "order!plugins/underscore-1.3.1", 
   "order!plugins/backbone-0.9.1", 
   "order!plugins/jquery.typewatch"]); 
require.config({
  waitSeconds: 30,
  paths: {
      "jquery": 'http://code.jquery.com/jquery-1.9.1'
  }
});

require(dependencies, function($) {
   ...

jQuery is loading OK, but I then get

Uncaught ReferenceError: jQuery is not defined     jquery.typewatch.js:92
Uncaught TypeError: undefined is not a function    backbone-0.9.1.js:1064

The first error is complaining about jQuery not being defined, and the second about $ not being defined.

Why isn't this working? Everything seems to be loading in the right order, the order plugin works OK for underscore and backbone, and I can use $ in the code for normal jQuery functions.

3
  • 1
    Duplicate of: stackoverflow.com/questions/14756567/… Commented Nov 8, 2013 at 19:11
  • Does stackoverflow.com/questions/14756567/… actually have an answer? Commented Nov 8, 2013 at 19:35
  • 1
    The order plugin is not supported in current versions of requirejs, it has been superseded by the feature used in the answer of the linked question. Read more about the change here and here. Commented Nov 8, 2013 at 19:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.