10. Enable Gatsby incremental builds in Netlify

Configuration

This note is about enabling the incremental builds feature released by Gatsby team couple of months back in Netlify.

I followed this article and below are the steps I did:

1. Enable the plugin

Created a new file netlify.toml in root and added following content to it.

[[plugins]]
  package = "netlify-plugin-gatsby-cache"

This enables the said plugin in the build process in Netlify.

2. Add flag

Added the following flag to the build command in package.json

"build": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages"

Issues

> Issue 1

It didn't work, So i updated the build command on Netlify website

netlify gatsby build command

> Issue 2

then I found below in the logs

netlify gatsby no cache

Its a known issue that the plugin doesn't work for preview deploys, at the time of writing this note.
(GitHub Issue: https://github.com/jlengstorf/netlify-plugin-gatsby-cache/issues/22)

But on production deploys, the plugin seems to find the cache perfectly fine.

netlify gatsby cache found

We'll see how today's configuration unfolds with future builds.

Till next time! ✌️


This GitHub commit represents what we've done in this post 🤩

Helpful?

If you think this is helpful 🎈
Don't keep it to yourself 🙊

Share it with your lovely followers at twitter 🗽

lets connect viatwitter