Call resolve, then require

This commit is contained in:
Jonathan Clem
2021-04-21 17:10:11 -04:00
parent 7e8659dcd4
commit 7e12bd7395
2 changed files with 15 additions and 6 deletions

View File

@@ -10,9 +10,14 @@ export const wrapRequire = new Proxy(__non_webpack_require__, {
try {
return target.apply(thisArg, [moduleID])
} catch (err) {
return target.resolve(moduleID, {
paths: eval('module').paths.concat(process.cwd())
})
const modulePath = target.resolve.apply(thisArg, [
moduleID,
{
paths: eval('module').paths.concat(process.cwd())
}
])
return target.apply(thisArg, [modulePath])
}
},