Bottom Line: It is 100% safe to delete node_modules/.cache/webpack. Deleting it will NOT delete your JavaScript source code, React/Vue components, or project packages.
What is the node_modules/.cache/webpack Folder?
Located inside JavaScript and TypeScript projects at node_modules/.cache/webpack, this folder is created when using Webpack 5 Persistent Caching.
Webpack caches compiled code chunks, module graphs, and Babel transpilation outputs on disk. When you run npm run build or start a dev server (like Next.js pages router or Create React App), Webpack uses this cache to bypass re-compiling unchanged JavaScript files.
Over long development cycles, stale Webpack cache files expand to 2 GB to 10 GB+ per project.
Can You Delete Webpack Cache?
✅ Yes, it is completely safe to delete.
- No source code loss: Your
src/directory,webpack.config.js, andpackage.jsonare untouched. - Fixes stuck build bugs: Deleting the Webpack cache is the official solution when Webpack builds fail to reflect recent-items)-items)-items)-items)-items)-items)-items)-items)-items)-items)-items)-items) code edits or throw stale module resolution errors.
- Auto-rebuilt: Webpack will automatically recreate a fresh cache directory next time you run
npm run build.
How to Safely Clean Up Webpack Cache
Method 1: Delete via Terminal Command
Navigate to your project directory and run:
# macOS / Linux
rm -rf node_modules/.cache/webpack
# Windows (Command Prompt)
rmdir /s /q node_modules\.cache\webpack
# Windows (PowerShell)
Remove-Item -Recurse -Force node_modules/.cache/webpack
Related Guides
- Learn about deleting node_modules folders.
- How to clean up Babel loader cache.
- Check if you can clean Vite cache.
Discussion
Loading authentication...