#Trying to create custom collections based on demo and getting compilation error

6 messages · Page 1 of 1 (latest)

night fog
#

In Payload 2 demo I think it was blog, I have commented out not needed collections in payload.config.ts:

`import Categories from './collections/Categories'
//import Comments from './collections/Comments'
//import { Media } from './collections/Media'
//import { Pages } from './collections/Pages'
//import { Posts } from './collections/Posts'
//import { Projects } from './collections/Projects'
import Users from './collections/Users'

export default buildConfig({
admin: {
user: Users.slug,
bundler: webpackBundler(),
components: {
// The BeforeLogin component renders a message that you see while logging into your admin panel.
// Feel free to delete this at any time. Simply remove the line below and the import BeforeLogin statement on line 15.
beforeLogin: [BeforeLogin],
// The BeforeDashboard component renders the 'welcome' block that you see after logging into your admin panel.
// Feel free to delete this at any time. Simply remove the line below and the import BeforeDashboard statement on line 15.
beforeDashboard: [BeforeDashboard],
},
webpack: config => ({...
},
editor: slateEditor({}),
db: mongooseAdapter({
url: process.env.DATABASE_URI,
}),
serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL,
collections: [/Pages, Posts, Projects, Media,/ Categories, Users/, Comments/],`

But then yarn build gives error: 'InvalidFieldRelationship: Field Posts page has invalid relationship 'pages''

Then how do I disable the unnecessary collections?

onyx micaBOT
night fog
#

I've also tried to run npm run payload generate:types which also gives the above error.

#

I have figured out the above error comes from /src/payload/globals/Settings.ts, after commenting out relationTo: 'pages', another relation errors comes out..

vestal cargo
#

@night fog Were you able to solve this?

night fog