Skip to content

Commit d99df4b

Browse files
authoredFeb 6, 2025··
fix: Runtime exception in Node SEA mode (#106)
1 parent 969b4f8 commit d99df4b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ if (Module.isBuiltin) { // Added in node v18.6.0, v16.17.0
6464
// as the `paths` options argument was added to the `require.resolve` function,
6565
// which is the one we want
6666
let resolve
67-
if (require.resolve.paths) {
67+
// require.resolve might be undefined when using Node SEA mode:
68+
// https://nodejs.org/api/single-executable-applications.html
69+
// Also see https://github.com/nodejs/require-in-the-middle/issues/105
70+
if (require.resolve && require.resolve.paths) {
6871
resolve = function (moduleName, basedir) {
6972
return require.resolve(moduleName, { paths: [basedir] })
7073
}

0 commit comments

Comments
 (0)
Please sign in to comment.