A React library (v0.2.3) for automatically clearing browser cache after app updates by generating a build version meta file and checking for new versions on interval. Designed to handle chunk load errors in code-split React apps. Works with React 16+. Provides a Boundary component, a hook, and render props. Similar to react-cache-clear but with more configuration options and built-in error handling. Low release cadence (last release 2020). Minimal bundle size.
npm install react-clear-browser-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates installation, meta file generation script setup, and basic usage of ClearBrowserCacheBoundary with auto-reload and a 60-second polling interval.
Add a prebuild script as shown in the README to auto-generate meta.json before each build.
Pass an array of custom checker functions to the errorCheckers prop.
Use the useClearBrowserCache hook inside a child of ClearBrowserCacheBoundary instead.
Choose a duration that balances freshness and network load (e.g., 60000 ms for 1 minute).
Run the script as: node ./node_modules/react-clear-browser-cache/bin/cli.js
Ensure the prebuild script runs successfully and generates a valid meta.json in your public directory.
Add auto prop to ClearBrowserCacheBoundary: auto={true} or auto={false}