Cache Build Assets in Cloudflare Workers

Updated on

For supported frameworks, Workers detects a specified cache directory for reuse in subsequent builds. For example, if building with Astro, Cloudflare looks for the node_modules/.astro/ folder.

Typically you exclude your node_modules folder from git. You can ignore everything except the above folder by adding these lines to your .gitignore file:

node_modules/*
!node_modules/.astro/

Further reading