diff --git a/src/vs/workbench/api/common/extHostRequireInterceptor.ts b/src/vs/workbench/api/common/extHostRequireInterceptor.ts index ad16a75c56b..46866f7db08 100644 --- a/src/vs/workbench/api/common/extHostRequireInterceptor.ts +++ b/src/vs/workbench/api/common/extHostRequireInterceptor.ts @@ -21,12 +21,12 @@ import { platform } from 'vs/base/common/process'; interface LoadFunction { - (request: string, parent: { filename: string; }, isMain: any): any; + (request: string): any; } interface INodeModuleFactory { readonly nodeModuleName: string | string[]; - load(request: string, parent: URI, isMain: any, original: LoadFunction): any; + load(request: string, parent: URI, original: LoadFunction): any; alternativeModuleName?(name: string): string | undefined; } @@ -245,7 +245,7 @@ class OpenNodeModuleFactory implements INodeModuleFactory { }; } - public load(request: string, parent: URI, isMain: any, original: LoadFunction): any { + public load(request: string, parent: URI, original: LoadFunction): any { // get extension id from filename and api for extension const extension = this._extensionPaths.findSubstr(parent.fsPath); if (extension) { @@ -253,7 +253,7 @@ class OpenNodeModuleFactory implements INodeModuleFactory { this.sendShimmingTelemetry(); } - this._original = original(request, { filename: parent.fsPath }, isMain); + this._original = original(request); return this._impl; } diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts index 10161ac3355..8e96e6738ec 100644 --- a/src/vs/workbench/api/node/extHostExtensionService.ts +++ b/src/vs/workbench/api/node/extHostExtensionService.ts @@ -31,7 +31,11 @@ class NodeModuleRequireInterceptor extends RequireInterceptor { if (!that._factories.has(request)) { return original.apply(this, arguments); } - return that._factories.get(request)!.load(request, URI.file(parent.filename), isMain, original); + return that._factories.get(request)!.load( + request, + URI.file(parent.filename), + request => original.apply(this, [request, parent, isMain]) + ); }; } } diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts index fdc57cbb2ec..a40ce65b7bf 100644 --- a/src/vs/workbench/api/worker/extHostExtensionService.ts +++ b/src/vs/workbench/api/worker/extHostExtensionService.ts @@ -89,7 +89,7 @@ class WorkerRequireInterceptor extends RequireInterceptor { } if (this._factories.has(request)) { - return this._factories.get(request)!.load(request, parent, false, () => { throw new Error(); }); + return this._factories.get(request)!.load(request, parent, () => { throw new Error('CANNOT LOAD MODULE from here.'); }); } return undefined; }