{"id":20864,"library":"wipe-webpack-cache","title":"wipe-webpack-cache","description":"Wipes webpack internal module cache in a controlled way for testing and mocking. Version 2.1.0 is stable; low release cadence. Requires NamedModulesPlugin and HotModuleReplacementPlugin in webpack config. Provides a filter-and-bubble approach to selectively clear cache entries. Useful with proxyquire and similar testing libraries.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/theKashey/wipeWebpackCache","tags":["javascript","webpack","require","cache","injection","test","mock","stub"],"install":[{"cmd":"npm install wipe-webpack-cache","lang":"bash","label":"npm"},{"cmd":"yarn add wipe-webpack-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add wipe-webpack-cache","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export is a function named 'wipe'.","wrong":"const wipe = require('wipe-webpack-cache')","symbol":"wipe","correct":"import { wipe } from 'wipe-webpack-cache'"},{"note":"Default import is the same as named 'wipe'.","wrong":"const wipe = require('wipe-webpack-cache').default","symbol":"default","correct":"import wipe from 'wipe-webpack-cache'"},{"note":"This package is a separate npm package 'wipe-node-cache', not this one.","wrong":"const wipeNodeCache = require('wipe-webpack-cache')","symbol":"wipeNodeCache","correct":"import { wipeNodeCache } from 'wipe-node-cache'"}],"quickstart":{"code":"import { wipe } from 'wipe-webpack-cache';\n\n// Wipe all modules except those in node_modules\nwipe(null, (fileName) => !fileName.includes('node_modules'));","lang":"typescript","description":"Shows how to import and use the wipe function to clear module cache for testing."},"warnings":[{"fix":"Add new webpack.NamedModulesPlugin() and new webpack.HotModuleReplacementPlugin() to plugins array.","message":"Requires NamedModulesPlugin and HotModuleReplacementPlugin in webpack config, or it will not work correctly.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev wipe-webpack-cache","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'wipe-webpack-cache'"},{"fix":"Use import { wipe } from 'wipe-webpack-cache' or import wipe from 'wipe-webpack-cache'","cause":"Incorrect import style (e.g., using default export incorrectly).","error":"wipe is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}