Skip to content

Commit

Permalink
fix: Runtime exception in Node SEA mode (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
BYK authored Feb 6, 2025
1 parent 969b4f8 commit d99df4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ if (Module.isBuiltin) { // Added in node v18.6.0, v16.17.0
// as the `paths` options argument was added to the `require.resolve` function,
// which is the one we want
let resolve
if (require.resolve.paths) {
// require.resolve might be undefined when using Node SEA mode:
// https://nodejs.org/api/single-executable-applications.html
// Also see https://github.com/nodejs/require-in-the-middle/issues/105
if (require.resolve && require.resolve.paths) {
resolve = function (moduleName, basedir) {
return require.resolve(moduleName, { paths: [basedir] })
}
Expand Down

0 comments on commit d99df4b

Please sign in to comment.