{"library":"netlify-plugin-ttl-cache","title":"Netlify TTL Cache Plugin","description":"netlify-plugin-ttl-cache is a Netlify build plugin designed to address common runtime errors, such as 'ChunkLoadError,' in single-page applications (SPAs) that utilize code splitting (e.g., `React.lazy`). Netlify's default behavior is to replace all static assets upon each new deployment, which can lead to issues if a user's browser attempts to load an old, cached JavaScript chunk that no longer exists on the server. This plugin, currently at version 1.0.2, mitigates this by allowing users to specify a build output directory and a Time-To-Live (TTL) for assets within it, effectively persisting legacy immutable assets across deployments for a defined period. This ensures that previously served assets remain available, preventing broken user experiences without manual intervention. The plugin is configured declaratively via `netlify.toml` and does not require changes to application JavaScript code.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install netlify-plugin-ttl-cache"],"cli":null},"imports":["[[plugins]]\npackage = \"netlify-plugin-ttl-cache\"","[plugins.inputs]\npath = \"build\"","[plugins.inputs]\nttl = 90"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"npm i -D netlify-plugin-ttl-cache\n\n# netlify.toml\n[[plugins]]\npackage = \"netlify-plugin-ttl-cache\"\n  [plugins.inputs]\n  path = \"build\" # Your build output directory, e.g., 'dist', 'out'\n  ttl = 90 # Assets will be cached for 90 days\n  # exclude = \"^/_nuxt/\" # Optional: Regular expression string pattern for files to exclude","lang":"toml","description":"This quickstart installs the plugin and configures it in `netlify.toml` to cache assets in the 'build' directory for 90 days, preventing chunk-load errors.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}