From d9f4a72eb08798411bce6648698ac4d411faaf9c Mon Sep 17 00:00:00 2001 From: ThrRip Date: Fri, 22 Dec 2023 01:59:20 +0800 Subject: [PATCH] admin: Lazy load `node-appwrite` in the entry middleware ... to avoid _Module "..." has been externalized_ warnings from Vite --- packages/admin/middleware/entry.global.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/admin/middleware/entry.global.ts b/packages/admin/middleware/entry.global.ts index 284dbcb..e695e08 100644 --- a/packages/admin/middleware/entry.global.ts +++ b/packages/admin/middleware/entry.global.ts @@ -1,5 +1,3 @@ -import { Client, Databases, Query } from 'node-appwrite' - export default defineNuxtRouteMiddleware(async (to) => { if (process.client) { return } @@ -17,6 +15,7 @@ export default defineNuxtRouteMiddleware(async (to) => { return navigateTo(useAppConfig().appHomeBase, { external: true }) } + const { Client, Databases, Query } = await import('node-appwrite') const backendClient = new Client() const backendDatabases = new Databases(backendClient) backendClient.setEndpoint(useAppConfig().backendBase)