Improved CommonJS Support and Relative File Path Normalizing
With this release, there is now support for converting CommonJS require() variable declarations inside of define() modules. This can be extremely helpful when using the r.js cjsTranslate configuration option.
CommonJS
Here are a few examples:
This:
var x = require('third');Becomes:
var x = third;This:
var x = require('third').exampleProp;Becomes:
var x = third.prop;This:
var x = require('third').exampleProp();Becomes:
var x = third.exampleProp();Relative File Paths
Also, relative file paths are also now getting normalized to JavaScript-standard variable names.
This:
define('./someModule', function() {}Becomes:
var someModule = function() {})();define('../modules/someModule', function() {}Becomes:
var modules_someModule = function() {})();