diff options
author | 2023-09-28 03:53:24 -0700 | |
---|---|---|
committer | 2023-09-28 03:53:24 -0700 | |
commit | 387f1260c9dc0cea667b44ec0152fff0cd4def25 (patch) | |
tree | 24dde83cf812481b6d1c8de316a30ece7b745a54 /src/js/builtins/Module.ts | |
parent | e60b3607c12c91959ec795228cc299703d5b09d0 (diff) | |
download | bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.tar.gz bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.tar.zst bun-387f1260c9dc0cea667b44ec0152fff0cd4def25.zip |
Get Next.js Pages Router to work (#6095)
* hell
* make it so bun-debug-src
* teag
* wild
* yippee
* fas
* fix async hooks assertions
* yap
* yeah that's wild
* aa
* a
* increase time allowed
* so trivial
Diffstat (limited to 'src/js/builtins/Module.ts')
-rw-r--r-- | src/js/builtins/Module.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/js/builtins/Module.ts b/src/js/builtins/Module.ts index 3d88f2484..b074d3488 100644 --- a/src/js/builtins/Module.ts +++ b/src/js/builtins/Module.ts @@ -4,6 +4,11 @@ export function main() { } export function require(this: CommonJSModuleRecord, id: string) { + return $overridableRequire.$call(this, id); +} + +// overridableRequire can be overridden by setting `Module.prototype.require` +export function overridableRequire(this: CommonJSModuleRecord, id: string) { const existing = $requireMap.$get(id) || $requireMap.$get((id = $resolveSync(id, this.path, false))); if (existing) { // Scenario where this is necessary: |