I am using Gatsby version "2.32.13" in my website and now I want to use Gatsby Incremental Build feature for my website but as my website is hosted on vercel I do not want to go for Gatsby Cloud. So what are the ways to implement this Gatsby Incremental Build feature without use of Gatsby Cloud
It should work on any CI/CD platform (Netlify, Vercel, etc) even in Gatsby Cloud the implementation is far way easier. You only need to tweak your deploy command by adding the environment variable GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES
. Like:
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
Note: the --log-pages
flag will help you to identify the built pages on each run
To ensure a cross-environment command support I'd recommend installing cross-env
dependency and tweaking the previous command accordingly:
cross-env GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
To give a full (and official from Gatsby team) explanation about the caveats:
Conditional Page builds is an experimental feature that only works with data updates. Data updates in Gatsby means, data that comes from the GraphQL layer, in this case only page queries are supported. It can work with JSON updates when using
gatsby-transformer-json
andgatsby-source-filesystem
.Gatsby at this point in time is not going to invest in this feature and it will probably stay experimental without any development.
For more info about our roadmap see https://www.gatsbyjs.com/blog/announcing-unified-gatsby