requireΒΆ

This function will load a javascript and return the exports as object. The function implements parts of the CommonJS Modules Specification.

require(path)
Arguments:
  • path (string) – Path to the javascript to load.
Returns:

The loaded javascript object exports.

Examples:

// Absolute path
var lib1 = require('/cms/lib/mylib.js');

// Relative path
var lib2 = require('mylib.js');

// Relative path (same as above)
var lib3 = resolve('./mylib.js');

// Relative path
var lib4 = resolve('../mylib.js');