diff --git a/src/vs/platform/sign/node/signService.ts b/src/vs/platform/sign/node/signService.ts index 515cc869e815ddb646d68fbcd18c696d9892cc83..b33e5e25be1705af55d8634b2120ed77cc9ab710 100644 --- a/src/vs/platform/sign/node/signService.ts +++ b/src/vs/platform/sign/node/signService.ts @@ -4,13 +4,21 @@ *--------------------------------------------------------------------------------------------*/ import { ISignService } from 'vs/platform/sign/common/sign'; +import { memoize } from 'vs/base/common/decorators'; export class SignService implements ISignService { _serviceBrand: any; + // Cache the 'vsda' import, because when the same missing module is imported multiple times, + // the ones after the first will not throw an error. And this will break the contract of the sign method. + @memoize + private vsda(): Promise { + return import('vsda'); + } + async sign(value: string): Promise { try { - const vsda = await import('vsda'); + const vsda = await this.vsda(); const signer = new vsda.signer(); if (signer) { return signer.sign(value);