mirror of
https://github.com/actions/github-script.git
synced 2026-04-07 14:49:25 +00:00
Add a catch to support requiring installed modules
This commit is contained in:
parent
3ca4cd5a00
commit
c1c139b0ab
2 changed files with 40 additions and 4 deletions
|
|
@ -4,8 +4,14 @@ export const wrapRequire = new Proxy(__non_webpack_require__, {
|
|||
apply: (target, thisArg, [moduleID]) => {
|
||||
if (moduleID.startsWith('.')) {
|
||||
moduleID = path.join(process.cwd(), moduleID)
|
||||
return target.apply(thisArg, [moduleID])
|
||||
}
|
||||
|
||||
try {
|
||||
return target.apply(thisArg, [moduleID])
|
||||
} catch (err) {
|
||||
return target.resolve(moduleID, {paths: [...module.paths, process.cwd()]})
|
||||
}
|
||||
return target.apply(thisArg, [moduleID])
|
||||
},
|
||||
|
||||
get: (target, prop, receiver) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue