In Node, CJS loader trying to require file first
Closed this issue · 2 comments
gobwas commented
It need to try to load it via fs first, then fallback to require (maybe, just when there is no fs module, like in browserified context).
gobwas commented
if (fs && fs.readFile) {
return self.async.promise(function(resolve, reject) {
// define path here
fs.readFile(path, function(err, src) {
if (err) {
reject(err);
} else {
resolve(src);
}
});
});
} else {
return this.require(path, options);
}
gobwas commented
Urgently closed in 0.2.2 version.