Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

payload-types

default discord avatar
rbadev11 months ago
6

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...

  • default discord avatar
    lekaytor11 months ago

    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

  • default discord avatar
    rbadev11 months ago

    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.

  • default discord avatar
    tan508511 months ago

    pretty sure that's the file you import the types from in your blocks/components? surely cant be a good idea to ignore it

  • default discord avatar
    lekaytor11 months ago

    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?

  • default discord avatar
    rbadev11 months ago

    That file is auto generated by Payload. We managed to add it to the

    .gitignore

    and successfully deploy it. To make it work, you need to add the

    generate:types

    command 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)

  • default discord avatar
    bhuvanbm711 months ago

    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 build

    to build script and add generate commands to generateall.


    This really solve most of the headaches when there is small changes in deployments.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.