Skip to content

Relative File Path Dependencies and CommonJS Require Includes

Compare
Choose a tag to compare
@gfranko gfranko released this 04 Mar 01:44
· 119 commits to master since this release

Relative File Path Dependencies

You can now use relative file paths (as many levels deep as you like) for your AMD dependencies, and they will work as expected. Special thanks to rstone770 for contributing this.

Check out this example:

AMD

define('./modules/example', [
  './example1',
  './example2',
  '../example3'
], function(one, two, three) {
  var test = true;
});

Standard JavaScript

var modules_example=function (one,two,three){
  var test=true;
}(modules_example1,modules_example2,example3);

CommonJS Require Includes with the Global Object Option

You can now use the CommonJS require() syntax with the globalObject option.

Check out this example:

AMD

var example = require('anotherModule');

Standard JavaScript

var amdclean={};
var example=amdclean['anotherModule'];