views:

50

answers:

1

I'm working on a large web application with many javascript files. I'd like to turn those into CommonJs Modules to make dependencies explicit. What browser-side loaders exist for CommonJs modules, and what are their limitations?

Browser targeted CommonJS loaders that I can find are Tiki and Yabble. Has anyone tried them, and how well do they work?

A: 

Merge your scripts, to load it faster, http://www.sencha.com/products/jsbuilder/! It's not only build extjs, it can build any kind of javascript.

But if you need module loader, try code.google.com/p/runjs/! Simple, well tested, well documented.

Roki
Do either of those support CommonJS Modules? They don't appear to.
Sean McMillan
The jsbuilder is an easy to use deployment toolkit. It merges your sources together, and create just one javascript file. You don't need to download them separately. It's good because, if you have tonns of sources, you don't need to download them separately, so you earned a lots of network overhead, and if you compressed the sources in the right order you don't have to care about, what peace of code evaluating first...But if your question is about, just incremental module loaders compatible width CommonJs, my personal favorite is http://www.sproutcore.com/, it have apple kind user interfaces
Roki
Are there examples for jsbuilder? There seems to be documentation for the file options, but it's pretty sparse.
Sean McMillan
Looks like runjs is replaced by requirejs: http://github.com/jrburke/requirejs
Sean McMillan
Sorry for the late response... If you download extjs core or extjs you can find *.jsb2 files these are samplebuilds especially for extjs, but you can build any javascript project with it. The online version of the ext build config file: http://code.google.com/p/extjs-public/source/browse/extjs-3.x/include/ext.jsb2?r=105
Roki
I ended up using RequireJs -- the new name of runJS. It also has a tool that lets you build a merged file.
Sean McMillan