1
votes

I have the following main.js

requirejs.config({
  baseUrl: 'js',
  paths: {
    "jquery": "http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"
  },
  shim: {
    'backbone': {
      deps: ['underscore', 'jquery'],
      exports: 'Backbone'
    },
    'marionette': {
      deps: ['jquery', 'underscore', 'backbone'],
      exports: 'Marionette'
    },
    'underscore': {
      exports: '_'
    }
  }

});

The code to require query:

define(['jquery', 'backbone', 'marionette'], function($, Backbone, Marionette) {

Backbone, marionette and underscore all load correctly, but requireJS is ignoring the 'paths' config and trying to load jquery from js/jquery.js, not the CDN.

Using requires 2.1.9

1
Can you show us the code that makes RequireJS load jQuery? (Either the define that lists jQuery as a requirement or the require that mentions jQuery.) - Louis
I have updated as requested - mrwooster

1 Answers

2
votes

You should exclude the ".js" extension from the CDN URL, just as you would for file paths in your baseUrl directory:

paths: {
    "jquery": "http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min"
  },