// sync loading var foo = require('modulename')
// authoring module.exports = function() {}
// json output format
{ "foo": { hash: "123ij1o35ij3o345ij", source: "function() { require('./modules/bar') }", requires: { "./modules/bar": "./bar" } }, "./bar": { // bar gets defined here } }
require('async-require')
// script output format require.define('modulename', function() { // something like json['modulename'].source() })
// async load var foo = require('foo')
setTimeout(function() { var bar = require('bar', function(err) { require('bar') }) }, 5000)
// various requires require('../../foo') require('foo') require('foo', cb) require('foo', false) require('foo', 'client-foo')
Do we want to make require easier in the browser?