A 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
npm i -D netlify-plugin-ttl-cache
Add the plugin to your netlify.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