Skip to content

Commit

Permalink
admin: Lazy load node-appwrite in the entry middleware
Browse files Browse the repository at this point in the history
... to avoid _Module "..." has been externalized_ warnings
from Vite
  • Loading branch information
ThrRip committed Dec 21, 2023
1 parent 9161446 commit d9f4a72
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/admin/middleware/entry.global.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Client, Databases, Query } from 'node-appwrite'

export default defineNuxtRouteMiddleware(async (to) => {
if (process.client) { return }

Expand All @@ -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)
Expand Down

0 comments on commit d9f4a72

Please sign in to comment.