Relation between CommonJS, AMD and RequireJS?

RequireJS implements the AMD API (source). CommonJS is a way of defining modules with the help of an exports object, that defines the module contents. Simply put, a CommonJS implementation might work like this: // someModule.js exports.doSomething = function() { return “foo”; }; //otherModule.js var someModule = require(‘someModule’); // in the vein of node exports.doSomethingElse … Read more

Prevent RequireJS from Caching Required Scripts

RequireJS can be configured to append a value to each of the script urls for cache busting. From the RequireJS documentation (http://requirejs.org/docs/api.html#config): urlArgs: Extra query string arguments appended to URLs that RequireJS uses to fetch resources. Most useful to cache bust when the browser or server is not configured correctly. Example, appending “v2” to all … Read more