aboutsummaryrefslogtreecommitdiff
path: root/src/js/builtins/Module.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/builtins/Module.ts')
-rw-r--r--src/js/builtins/Module.ts12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/js/builtins/Module.ts b/src/js/builtins/Module.ts
index ca7c0fa91..d6ebc8578 100644
--- a/src/js/builtins/Module.ts
+++ b/src/js/builtins/Module.ts
@@ -82,17 +82,7 @@ export function require(this: CommonJSModuleRecord, id: string) {
}
export function requireResolve(this: string | { path: string }, id: string) {
- // This try catch is needed because err.code on ESM resolves is ERR_MODULE_NOT_FOUND
- // while in require.resolve this error code is only MODULE_NOT_FOUND.
- // `local-pkg` will check for .code's exact value, and log extra messages if we don't match it.
- try {
- return $resolveSync(id, typeof this === "string" ? this : this?.path, false);
- } catch (error) {
- var e = new Error(`Cannot find module '${id}'`);
- e.code = "MODULE_NOT_FOUND";
- // e.requireStack = []; // TODO: we might have to implement this
- throw e;
- }
+ return $resolveSync(id, typeof this === "string" ? this : this?.path, false);
}
export function requireNativeModule(id: string) {