#Custom component in global beforeDocumentControls not being added to importmap

7 messages · Page 1 of 1 (latest)

worthy olive
#

Hi all, First time posting here.

I have a global AdminSettings, when i add a custom component to the beforDocumentControls it is not being picked up by the importmap (even after running generate:importmap) . Which then triggers this error in the admin:

getFromImportMap: PayloadComponent not found in importMap {key: "@/components/BackupButton#BackupButton"PayloadComponent: "@/components/BackupButton#BackupButton"schemaPath: "@/components/BackupButton#BackupButton"} "You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime."

if i added the same component in the fields array of the global it does add it to the importmap:

{
    type: "ui",
    name: "manualBackupField",
    admin: {
        components: {
            Field: "@/components/BackupButton#BackupButton",
        },
    },
},

if i have both in the global at the same time, the button in beforeDocumentControls appears correctly. i also tried importing in beforeDocumentControls with 'path' instead but that made no difference.

worthy olive
#

(using payload 3.60.0)

novel spindle
#

Hi, having the same problem here. Just in case tried latest version (3.69.0) - no luck. As a workaround I add it manually to importMap.ts before commit, but, of course PL wipes it out after reloading in dev mode.

lofty basin
#

I can see the fix for this, I will create a PR for it shortly, then you can use pnpm patch in the interim until it’s released.

lofty basin
novel spindle
#

Thank you very much! That's what I thought - that field is missed at importMap generation.