Skip to content

Commit

Permalink
Make the require patch more compatible with others
Browse files Browse the repository at this point in the history
Signed-off-by: William So <[email protected]>
  • Loading branch information
polyipseity committed Jul 24, 2023
1 parent a905ce7 commit 48ee70f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-berries-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"obsidian-modules": patch
---

Make the `require` patch more compatible with other `require` patches.
8 changes: 4 additions & 4 deletions sources/require/require.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ function createRequire(
cwd: [],
dependencies: new WeakMap(),
},
async import(this: Require, id0: string, opts?: ImportOptions) {
const { context, resolve: resolve1 } = this,
async import(id0: string, opts?: ImportOptions) {
const { context, resolve: resolve1 } = ret,
[rd, cache] = resolve0(
this,
ret,
id0,
await resolve1.aresolve(id0, context),
),
Expand Down Expand Up @@ -387,7 +387,7 @@ function patchRequire(
self0.console.debug(error)
return req(...args)
}
}, proto, req)
}, req) as NodeRequire
},
toString: aroundIdentityFactory(),
})
Expand Down

0 comments on commit 48ee70f

Please sign in to comment.