Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolveExternal(fromfile, fileDirname, scope, dep) {
log.debug("resolve external %s", dep.value);
const org = dep.value, lScope = scope;
let filename = join(dep.value), tree, currentRequire, main, path, ext;
const [name] = filename.split(sep, 1);
return deferred.promisifySync(() => {
// If already processed, return result
if (this.modules[name]) return this.modules[name];
if (name === "webmake") {
this.packages.webmake = resolve(__dirname, "../");
return (this.modules.webmake = {});
}
// Find path to package with Node.js internal functions
currentRequire = getRequire(fromfile);
try {
path = main = currentRequire.resolve(name);
} catch (e) {
// No main module for the package, try full require path
try {
path = currentRequire.resolve(org);
} catch (e2) {