unAMD browserify transform - convert AMD to CommonJS

These days I had to implement a build script, on a project we are launching in the very near future. The JavaScript is written with AMD (RequireJS), which is very good for development, since there is no compile step, no source-maps, etc. Yet for production builds I found r.js is not the best tool around.

Instead, I went for browserify, which does a great job when bundling multiple js files. The problem was the AMD - CommonJS difference in style.

So I set out to write a browserify transform plugin. I think AMD is easier to work with than browserify in the development stage, since you have no additional build step. But as for bundling files to production, browserify is king, so unAMD helps you get the best of both world.

unAMD

It does the job very well for me. Try it out, have fun and share your thoughts.