next-clear-cache
v1.0.7
Published
A CLI tool to clear the Next.js fetch cache
Downloads
20
Readme
Next.js Cache Cleaner
A simple command-line utility to clear the Next.js cache directory during development.
Why Use Next.js Cache Cleaner?
Next.js, by default, has an aggressive caching mechanism to optimize performance and improve build times. While this is beneficial in production, it can sometimes cause stale or outdated data to be served during development. It's particularly annoying when working with the route handlers that you don't want to opt-out of caching in production. This CLI tool allows you to easily clear the cache in development without reconfiguring your APIs to be ALWAYS dynamic.
When you're actively developing your Next.js application and making frequent changes, you may encounter situations where the cache needs to be cleared to see the latest updates. This is where Next.js Cache Cleaner comes in handy.
With a single command, you can easily clear the Next.js cache directory and ensure that your development environment is using the most up-to-date files.
Installation
npm install -g next-clear-cache
Usage
Next.js Cache Cleaner provides two simple commands to clear the cache:
Clear the entire .next/cache directory:
npx next-clear-cache .
or
Clear only the .next/cache/fetch-cache directory:
npx next-clear-cache fetch
Choose the appropriate command based on your needs. Clearing the entire cache directory will remove all cached files, while clearing only the fetch-cache directory will specifically target the cached data related to data fetching.
Benefits
Easily clear the Next.js cache during development.
Ensure your development environment is using the latest files.
Avoid stale or outdated data being served.
Simple and intuitive command-line interface.
License
This project is licensed under the MIT License.