From a341b9a4ead957adedfcd25a7e4169954e144018 Mon Sep 17 00:00:00 2001 From: Shirasawa <764798966@qq.com> Date: Tue, 16 Sep 2025 10:19:00 +0000 Subject: [PATCH] feat: dynamically load @azure/msal-browser --- src/lib/utils/onedrive-file-picker.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/utils/onedrive-file-picker.ts b/src/lib/utils/onedrive-file-picker.ts index 7840ee869d..be23a512e3 100644 --- a/src/lib/utils/onedrive-file-picker.ts +++ b/src/lib/utils/onedrive-file-picker.ts @@ -1,5 +1,4 @@ -import { PublicClientApplication } from '@azure/msal-browser'; -import type { PopupRequest } from '@azure/msal-browser'; +import type { PopupRequest, PublicClientApplication } from '@azure/msal-browser'; import { v4 as uuidv4 } from 'uuid'; class OneDriveConfig { @@ -77,6 +76,7 @@ class OneDriveConfig { } }; + const { PublicClientApplication } = await import('@azure/msal-browser'); this.msalInstance = new PublicClientApplication(msalParams); if (this.msalInstance.initialize) { await this.msalInstance.initialize(); @@ -136,7 +136,7 @@ async function getToken( const msalInstance = await config.getMsalInstance(authorityType); const resp = await msalInstance.acquireTokenSilent(authParams); accessToken = resp.accessToken; - } catch (err) { + } catch { const msalInstance = await config.getMsalInstance(authorityType); try { const resp = await msalInstance.loginPopup(authParams); @@ -179,6 +179,7 @@ interface PickerParams { interface PickerResult { command?: string; items?: OneDriveFileInfo[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; } @@ -221,6 +222,7 @@ interface OneDriveFileInfo { driveId: string; }; '@sharePoint.endpoint': string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; } @@ -319,7 +321,7 @@ export async function openOneDrivePicker( } else { throw new Error('Could not retrieve auth token'); } - } catch (err) { + } catch { channelPort?.postMessage({ type: 'result', id: portData.id,