Hi,
Does it make sense to add the payload-types.ts to .gitignore? We get a lot of conflicts when we merge/rebase with dev.
It get re-generated during build doesn't it?
On the same token, how large can the payload-types.ts be? We are up to 40000+ lines, and I wonder if it is possible to generate smaller types files according to blocks or fields, etc...
I’ve got it in my .gitignore, since it’s just a generated file anyway… but yeah, I’m still in dev mode for now, haven’t deployed anything yet — I think it shouldn’t matter
There is nothing in the docs regarding this. I guess we need to do some trial and error testing to see it anything breaks during deployment.
Thanks for the reply.
pretty sure that's the file you import the types from in your blocks/components? surely cant be a good idea to ignore it
I don't think it is necessary to save something that is automatically generated, when you have made new collections you should always generate the types because otherwise it doesn't work, and during a deployment that would have been previously tested, right?
That file is auto generated by Payload. We managed to add it to the
.gitignoreand successfully deploy it. To make it work, you need to add the
generate:typescommand to your Dockerfile, so it gets generated during deployment. It is the best of both worlds, it gets type checked during dev, and by the time it gets deployed the types validation is already done.
If you are not using Docker, then you add the it to your deployment workflow (I assume)
If you don't mind adding 3 seconds in your build, its better you add a script which generates types as well as import maps before running next build.
I planned on using same repo to deploy on multiple platforms and same repo for multiple project websites. Few on vercel, and one instance on railways.
I used to get build errors as i was using different storage and db plugin adapters in each deployment and different in dev. So to solve this, all I did is to add
bun run generateall && bun run buildto build script and add generate commands to generateall.
This really solve most of the headaches when there is small changes in deployments.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.