Closed Dan6erbond closed 1 month ago
Hey @Dan6erbond
These plugins aren't up to date with the current version and it should be fixed in their repository. not payloadcms/payload
For me it had nothing to do with any plugins.
I had the same error (Unknown file extension ".css"
in react-image-crop
). I duplicated my code and removed step-by-step anything that could be an issue until I had an almost clean PayloadCMS instance.
The problem was, that I had an util function for creating collection groups and a react hook (using usePayloadAPI) in the same file, like this:
import {CollectionConfig} from 'payload'
import {usePayloadAPI} from '@payloadcms/ui'
export const withGroup = (group: NonNullable<CollectionConfig['admin']>['group']) => (collection: CollectionConfig): CollectionConfig => ({
...collection,
admin: {
...collection.admin,
group
}
})
export const useCurrentUser = () => {
const {data: {user}, isLoading, isError} = usePayloadAPI('/api/users/me')[0]
return {
user,
isLoading,
isError
}
}
After separating those functions in different files everything worked fine (i.e.: I could generate the types again).
So I guess: Try to find any files that will be searched during type generation and separate any client-side code from server-side code!
I have the same error as @w41x , I wonder if there is a faster way to find the problem file without step by step removal 😅
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
Link to reproduction
No response
Environment Info
Describe the Bug
When adding the "@payload-enchants/better-localized-fields" or "@payload-enchants/better-use-as-title" plugins, I get the following error:
While I would usually post an issue like this on the plugin's repo, it seems to be a Payload issue that comes from Payload's
react-image-crop
dependency as seen in myyarn.lock
file:Reproduction Steps
@payload-enchants/better-use-as-title
.payload.config.ts
:export default buildConfig({ ...config, plugins: [betterUseAsTitle({ collections: [] })] })