fix: pass module resolution paths to wrapped function (#25891)

This commit is contained in:
Matt Kane 2020-10-14 18:13:45 +01:00 committed by GitHub
parent 9b43935b07
commit dfbb88c5f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,10 +43,10 @@ if (process.type === 'renderer') {
} }
const originalResolveFilename = Module._resolveFilename; const originalResolveFilename = Module._resolveFilename;
Module._resolveFilename = function (request: string, parent: NodeModule, isMain: boolean) { Module._resolveFilename = function (request: string, parent: NodeModule, isMain: boolean, options?: { paths: Array<string>}) {
if (request === 'electron' || request.startsWith('electron/')) { if (request === 'electron' || request.startsWith('electron/')) {
return 'electron'; return 'electron';
} else { } else {
return originalResolveFilename(request, parent, isMain); return originalResolveFilename(request, parent, isMain, options);
} }
}; };