importing from
@payloadcms/uiin your Payload Config is not allowed, as you're bringing client-side files into your Payload Config, which is server-only. You can only import from
@967091941873426493/ui in client-side components that are not directly imported by the Payload Config
oh then, that is the error.
I am importing it to use it on a custom field.
The custom Field is used in a collection and the collection is imported in the payload config.
Which should be the Payload way then? I wanted to use useField to get the state of a previous field
You should still be able to use
useFormFieldinside of your custom field component file.
Can you share how you're defining the custom component in your config?
You should be passing a path to the component - it sounds like you are importing this component directly
I think the problem was that I had my component inside /src/fields/.../component.ts
I checked this source code:
https://github.com/aaronksaunders/payload-custom-text-field-1-2025/blob/main/src/collections/Users.tsPutting the component inside the collection folder and importing them like this:
{
name: 'fullName',
type: 'text',
admin: {
readOnly: true,
components: {
Field: '@/collections/CustomFields/CustomFullNameTextFieldClient',
},
},
},
no more issues generating types, the importmap or running the app and using payload ui
thank you!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.