Caching built images between deployments - Astro Project

Hi there,

I’ve an Astro site that has about 40 pages but each of those, has 3/4 images.

When I run a build, these images get transformed into various formats / sizes and can bloat the build times.

Astro has a folder for these images called _astro and when I run a build locally, Astro detects that there’s a cache and doesn’t retransform those images.

I believe Netlify should have the same bahaviour but for some reason it’s not the case at the moment. All the images get rebuilt every deployment.

Is there something simple I’m missing?

Thanks

Netlify on top, locally on bottom:

You need to add the files to Netlify’s cache. Read more about this here: Create Build Plugins | Netlify Docs. Example usage: tejal/scripts.ts at v8 · hrishikesh-k/tejal (github.com)