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

Add Support For Environments Without require() #1

Closed
mcordingley opened this issue May 8, 2013 · 6 comments
Closed

Add Support For Environments Without require() #1

mcordingley opened this issue May 8, 2013 · 6 comments

Comments

@mcordingley
Copy link

I like the idea behind your library, but the user must have require() defined with how it is currently written. There is a pattern for being able to support CommonJS, AMD, and plain-old globals called UMD, or Universal Module Definition. I'd submit a pull request, but I don't know CoffeeScript.

The UMD pattern with the broadest environment support:
https://github.com/umdjs/umd/blob/master/commonjsStrict.js

@andreypopp
Copy link
Owner

Hello, I'll try to provide separate builds with UMD.

btw. did you consider using browserify?

@mcordingley
Copy link
Author

It certainly is a possibility, but it's also an additional dependency that is both easy to avoid and could easily grossly complicate a setup, particularly if the project already uses something like require.js.

@mcordingley
Copy link
Author

Point of fact, I have a current project that uses require.js and AMD modules. It has a case in it where this code would be a big help, and I'd pull this into that project in a heart-beat, except for the difficulty of integration with the module system that I'm using.

@ericlbarnes
Copy link

Just wanted add a 👍 to this. I am in a situation where this would be perfect but our code base isn't using commonjs or requirejs and not really interested in adding browserify.

@andreypopp
Copy link
Owner

Now there's a build which exports BackboneProjections as a global. I guess you can also use this with AMD loader like require.js by supplying shim in a config:

shim: {
  "backbone.projections": {
    exports: "BackboneProjections",
    deps: ["underscore", "backbone"]
  }
}

@mcordingley
Copy link
Author

That works for me. Thanks!

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

No branches or pull requests

3 participants