With the recent changes regarding Build Times, I was hoping someone could share any and all tips regarding how to optimize my build times. I am currently sitting at 8 minutes for my project. That means I can possibly reach a max of 37 updates in a month.
Can anyone help me figure out why netlify tries to upload 500+ files on every single tiny change.
In case this could be useful for others, so far what I have found out today regarding optimizing build times:
Stopping Auto Publishing
One of the things that Netlify does, auto-publishes on every tiny commit to the “main” usually master branch. To be honest, this is a really cool thing but is very costly. This becomes a pretty big issue as every other day, Dependabot puts in like 5-6 pull requests. Merging one triggers the first deploy and then merging the rest trigger a second deploy after that first one is complete. Sometimes if there are conflicts that take quite a while for Dependabot to resolve it can even cause a necessary third/fourth build needed.
Stopping Deploy Previews
Another thing that I can imagine will cause build times to start skyrocketing is automated deploy previews. Once again, although this is an incredibly amazing feature it will cause the build times to increase way too much.
Stop all the deploy previews on branches.
I tried using Gatsby-Plugin-Netlify-Cache recently but with its default settings I saw only a 1 minute decrease in the build times. I am going to try enabling the options to cache the public folder even though there is a warning attached to it. Hopefully this should fix some of the build times on my site. If anyone has had luck with this plugin so far please let me know.
If there are any other tips I would really appreciate it.