Module/Require Features #94

francoislaberge opened this Issue Nov 24, 2010 · 4 comments


None yet

4 participants


Maybe I'm missing it, but there is no module loading support in backbone.js, is that correct?

If so are people using RequireJS? I've like it on other projects, just evaluating JS libs right now and Backbone is looking just the right balance between heavyJS Frameworks and a sparse javascript libs.

tapichu commented Nov 25, 2010

I used both in this sample project.
I hope you find it useful!


That's correct -- there is no module loading support. I don't think that the to-RequireJS-or-not-to-RequireJS has anything to do with Backbone, really.

My personal opinion is that JavaScript module loading has no place in web applications. You should be concatenating, compressing, and gzipping your JS assets as a single file, so that your app can be loaded with a single cacheable HTTP request (preferably with far-futures expires headers). Our own stab at doing this sort of thing in the context of a Rails app is available here:

Dynamic module loading can make sense in the context of truly enormous JS apps like GMail, where you're talking about megabytes of JavaScript that should only be loaded when that portion of the app is accessed, but good asset packaging is still useful for that, and things like RequireJS are still overkill.

rmurphey commented Dec 3, 2010

Agree that module loading isn't relevant to Backbone, but I did want to clarify: RequireJS lets you specify dependencies in your development code, and then create combined, minified, and optimized files for production using its optimization tool. For browser-based JS, its goal isn't so much to let you do module loading in production as it is to let you develop small units of functionality, express dependencies between them, and know that you can generate optimized code when you're done.


Thank Rebecca, I hadn't had the time to reply. Those are basically my thoughts on the subject.

I was only asking before if there was a module system that people were using that was either a part of it or typically used by others. I'm using RequireJS everywhere, including on the backend.

I worked with James to flush out some bugs I was having, my app uses a lot of other Frameworks/Projects and it now works perfectly with modules built to work in both environments. So far it is mostly form validation and Object/Storage Serialization/Deserialization that is being used. It has been very helpful.

Just saying.

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