From 39f7db84fbdbb591a5e5146eb6530ba0ac3b58e1 Mon Sep 17 00:00:00 2001 From: ordinarthur Date: Fri, 20 Mar 2026 23:42:31 +0100 Subject: [PATCH] fix: add ComponentLoader for @adminjs/upload v4 compatibility Co-Authored-By: Claude Opus 4.6 --- admin.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin.mjs b/admin.mjs index 10a7c71..cb97e88 100644 --- a/admin.mjs +++ b/admin.mjs @@ -1,4 +1,4 @@ -import AdminJS from 'adminjs' +import AdminJS, { ComponentLoader } from 'adminjs' import AdminJSFastify from '@adminjs/fastify' import { Database, Resource, getModelByName } from '@adminjs/prisma' import uploadFeature from '@adminjs/upload' @@ -10,6 +10,8 @@ import { prisma } from './src/lib/db.mjs' AdminJS.registerAdapter({ Database, Resource }) +const componentLoader = new ComponentLoader() + const stripe = process.env.STRIPE_SECRET_KEY ? new Stripe(process.env.STRIPE_SECRET_KEY) : null @@ -183,6 +185,7 @@ async function autoComputeFields(response) { export async function setupAdmin(app) { const admin = new AdminJS({ rootPath: '/admin', + componentLoader, resources: [ { resource: { model: getModelByName('Product'), client: prisma }, @@ -242,6 +245,7 @@ export async function setupAdmin(app) { }, features: [ uploadFeature({ + componentLoader, provider: { local: { bucket: UPLOADS_DIR }, },