lix-website/themes/lix/assets/bootstrap/node_modules/rechoir/lib/register.js

16 lines
360 B
JavaScript
Raw Normal View History

2024-04-27 03:39:10 +00:00
const path = require('path');
const resolve = require('resolve');
module.exports = function (cwd, moduleName, register) {
try {
var modulePath = resolve.sync(moduleName, {basedir: cwd});
var result = require(modulePath);
if (typeof register === 'function') {
register(result);
}
} catch (e) {
result = e;
}
return result;
};