Is there a way to skip `gatsby build` if you add new fields to CMS?

While developing I use ENABLE_GATSBY_REFRESH_ENDPOINT=true and curl -X POST http://localhost:8000/__refresh in order to fetch new content if I have updated in Prismic CMS.This saves time since I don't have to rungatsby build`.

When I add a new field to a page or a slice. I have to execute gatsby build and gatsby develop. Both take time to execute (a couple of minutes). This has to be done so that the field will become available in GraphQL and I could query it. This costs time...

I wonder if there is a way to set up development workflow in a similar way as updating content when it comes to adding fields to CMS so that I don't have to waste time on rebuilding the website. Do you have any recommendations on how to deal with this?

Hello Anton!

According to the gatsby docs, this environment variable is useful to refresh sourced content without restarting the development server. This is done automatically when you enable the Preview feature inside your project. It fetches the new content of existing and unpublished docs.

It is true that you have to clean the cache when you modify a Custom type in order to get a new version of the schema, for that you simply run the gatsby clean command. It does exactly what you need, which is to retrieve the updated schema plus it is quicker than doing a complete build. Builds should be done when your project is ‘production ready’.

Read the official gatsby docs about: Differences between develop and build

Hi @Pau,

Somehow gatsby clean did not work before, yet now it does… Maybe I made an assumption that was simply not true.

It took me more than 5 minutes to fetch the fields (clean, build, develop).

Thanks for the tip I only loose 2m 25s now when I execute gatsby develop.