Skip to content

Commit

Permalink
fix(factory): fix require.resolve not work as experted
Browse files Browse the repository at this point in the history
  • Loading branch information
chemzqm committed Feb 27, 2025
1 parent 5770528 commit 4118fb2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { createLogger } from '../logger'
import { fs, path, vm } from '../util/node'
import { hasOwnProperty, toObject } from './object'
const requireFunc = require

export interface ExtensionExport {
activate: (context: unknown) => any
Expand Down Expand Up @@ -73,7 +74,8 @@ function makeRequireFunction(this: any, cocExports: any): any {
}
return this.require(p)
}
req.resolve = request => Module._resolveFilename(request, this)
req.resolve = requireFunc.resolve.bind(requireFunc)
// request => Module._resolveFilename(request, this)
req.main = mainModule
// Enable support to add extra extension types
req.extensions = Module._extensions
Expand Down

0 comments on commit 4118fb2

Please sign in to comment.