simple-browser-require
simple-browser-require is a simple, node.js-like require()
for the browser. It is not an asynchronous script loader.
Usage
Wrapping each module in a require.register
call:
require;
...allows the require
function to return the module's public contents:
var lib = ;
...exposed by decorating the exports
object:
var myModuleVar = 'my module'; exports { return myModuleVar;};
...or overwritting the exports
object completely:
{ thismyVar = 'my instance var';}; MyModuleprototype { return thismyVar;}; moduleexports = MyModule;
Each module is supplied with a require
function that resolves relative module ids:
var lib = ; // in current packagevar SomeClass = ; // in parent packagevar util = ; // from root package