A Netlify plugin for persisting immutable build assets across releases.
npm install netlify-plugin-ttl-cacheA Netlify plugin for persisting immutable build assets across releases.
By default, Netlify replaces all existing static assets when publishing new releases.
For sites where assets are unique across deployments, and dynamically loaded (e.g. React.lazy) this can lead to runtime errors (e.g. chunk-load errors).
This plugin prevents this problem by allowing users to include legacy assets across releases.
Install the plugin
``sh`
npm i -D netlify-plugin-ttl-cache
Add the plugin to your netlify.toml
`toml`
[[plugins]]
package = "netlify-plugin-ttl-cache"
[plugins.inputs]
path = "build"
ttl = 90
_Build output directory._
type: string
default: "build"
_Maximum age (days) of files in cache._
type: number
default: 90
_Regular expression string pattern for files to exclude._
type: string
default: n/a`