- Minification and obfuscation became a trivial single step process. R.js helped us out very well with this.
- All our angular components like services, controllers, directives etc were AMD module factories agonistic of angular. We had another AMD module which required all the angular components and registered them as angular services,controllers etc. This is inversion of control personified. This reduces the spread of integration to one file. Any integration problem could thus be found in that single file with high probability.
- Without the above structure, unit testing would have been very tedious. Decomposing the application into AMD modules and using RequireJs to inject only the dependencies pertaining to the current module simplifies the effort to setup unit tests.
- RequireJs allows you to mock module dependencies. This helped us to write end to end tests without having the need to bring up a server. This takes advantage of the RequireJs mechanism to use noconflict dependencies.
- Cache busting by adding version to the url became trivial since RequireJs allows you to specify url args.
- RequireJs allows you to load dependencies lazily. We were not able to find a straightforward way to specify angular components to be loaded laziliy. This would have helped us to save a lot on the initial bandwidth required to load the application.
RequireJs simplifies your java script application. Some of its benefits are really simple, but have huge impact, like, not having to check for the existence of a global variable and initialize it in every file, not having to use global variables as a place to store common scripts etc. That said, you could really put it through its paces by doing complicated things like using multiple version of a library simultaneously, minify all the js files into a single file easily etc.