For now it caches $NETLIFY_BUILD_BASE/.cache
. That means if we want to cache sth. for next build, it has to be in there.
However, the build script clones the repo into $NETLIFY_REPO_DIR
, which is not $NETLIFY_BUILD_BASE
. As a result, if we create a build script for netlify, and if we want it also run locally, we have to somehow deal with /opt/buildhome
or $NETLIFY_REPO_DIR
.
What I actually want to do is to also cache $NETLIFY_REPO_DIR/.cache
, or let’s call it ./.cache
.
However, this cannot be a default, since, it might be a part of the repo.
So I am suggesting instead, a custom build cache entry, which can be similar to how we set publish directory, like this:
[build]
publish = "dist/"
cache = ".cache/"
or
[build]
cache = [ ".cache/" ]
Or maybe,
[build]
publish = "dist/"
cache = [ ".cache/", "dist/" ]
This way, incremental build can be implemented without a plugin.
This is definitely beneficial for tool chains without official incremental build support on netlify. It can also be good for next.js and gatsby, since the plugin is no longer needed.