4 ms·
Nothing beats my dependency manager, which I'll just call DrGonzo: var exports = {}; function require(modname) { if (modname == 'jquery') return $;
by sehugg 8y ago
Nothing beats my dependency manager, which I'll just call DrGonzo:
var exports = {};
function require(modname) {
if (modname == 'jquery') return $;
else if (modname.startsWith('.')) return exports;
else { console.log("Unknown require()", modname); return exports; }
}
(Of course you've gotta <include> the modules ahead of time -- I actually use this for http://8bitworkshop.com/ http://8bitworkshop.com/)