0

I am using require.js 2.0.

I have the following code that is called initially by require: app.js

requirejs.config({
   paths: {
           app: '..',
           spine: 'spine_src/spine',
           cs: "cs",
   },
   shim: {
        'spine_src/route': {
             deps: ['spine']
         }
    }
});

// Start the main app logic.
requirejs(['cs!app/StartApp_Admin', 'spine','spine_src/route'],
function (StartApp_Admin, Spine, Route) {
{
    new StartApp_Admin(); 
}
});

And the following controller: StartApp_Admin

define () ->
 class StartApp_Admin extends Spine.Controller
    constructor: ->
        @routes
            "/twitter/:id": (params) ->
                console.log("/users/", params.id)

        Spine.Route.setup()

When I execute the application I get the following error in my spine route library file (route.js). The application breaks when I call Spine.Route.setup()

Uncaught TypeError: Object function (element) {return element;} has no method 'extend'

Any help would be greatly appreciated

  • So i think the problem is that Spine.js Libraries use commonJs and i am trying to requireJs in my application. Does anyone know how to make them play nice with each other? –  Jun 14 '12 at 20:07
  • Added jquery to the deps list, and it should work fine. See: https://github.com/jrburke/requirejs/wiki/Upgrading-to-RequireJS-2.0#wiki-shim Notice how he lists underscore and jquery. This will not work with the built version of r.js. – Drew Sep 14 '12 at 19:01

1 Answers1

0

Got it to work. I had to use the require-jquery library. Jquery wasn't loading properly.

http://requirejs.org/docs/jquery.html