support for require.js 2.x #26

Closed
mic0331 opened this Issue Oct 18, 2012 · 11 comments

Projects

None yet

7 participants

@mic0331
mic0331 commented Oct 18, 2012

Hello,

I'm trying to use backbone.iobind with require.js
I have the following error message

Uncaught ReferenceError: module is not defined at backbone.iosync.js:8
Uncaught ReferenceError: module is not defined at backbone.iosync.js:8

my shim config is set as follow

shim: {
    backbone: {
        deps: ["jquery", "underscore"],
        exports: "Backbone"
    },
    underscore: {
        exports: '_'
    },        
    iosync: {
      deps: ["jquery", "underscore"],
      exports: "iosync"
    },
    iobind: {
      deps: ["jquery", "underscore", "iosync"],
      exports: "iobind"
    }
}

Could you please tell me if i have something wrong and if not when you are planning to support requirejs 2x ?

many thanks

@TomiS
TomiS commented Nov 1, 2012

Hi. Just to add weight, I think I'm having the same problem. Does anyone have a solution?

@pgherveou
Contributor

Hi there
You should not need to add iobind to the shim section as its already comes with requirejs support
https://github.com/logicalparadox/backbone.iobind/blob/master/dist/backbone.iobind.js#L1-L12

Try to add it to your require config and let me know if this works or not, I ll have a closer look at it this weekend

@TomiS
TomiS commented Nov 1, 2012

Hi @pgherveou and thanks for quick reply. I tried removing iobind from shim and just added it to paths. I also tried various other configurations (e.g. with and without shimmed iosync) and even added socket.io as a dependency for the iosync/iobind to ensure it's loaded before those two. And nothing helped. The error just stayed. So it would be cool if you'd have time to look at this.

@pgherveou
Contributor

I ll take care of this asap (most likely this weekend)
if you are in a rush you can always remove the common js boilercode and wrap the lib inside a define call

define(['underscore', 'backbone'], function (_, Backbone) {});
@xiaods
xiaods commented Nov 30, 2012

any updates?

@Puigcerber
Contributor

Did somebody manage to solve this? Because I'm experiencing the same problem.

@kevindurb

Hey I'm having this same problem...

@xiaods
xiaods commented Mar 8, 2013

hi,all don't use requireJS will bypass this issues.

@Puigcerber
Contributor

Hi @kevindurb!

Check my pull request #30 as it solved the problem for me. I'm waiting for @logicalparadox to approve it but it works.

Cheers, Pablo.

@logicalparadox
Contributor

#30 merged with changes in the dist. hope that helps.

@Puigcerber
Contributor

Cool, thanks, I would say that you can close this issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment