babel-plugin-rewire

JSON →
library 1.2.0 ·javascript
verified May 27, 2026

A Babel plugin that adds __Rewire__, __ResetDependency__, and __GetDependency__ methods to modules for mocking dependencies in tests. Version 1.2.0 is stable with moderate release cadence. It supports ES6 import, CommonJS require(), and top-level variable/function rewiring. Unlike proxyquire or rewire.js, it works at the AST level via Babel, enabling rewiring of named exports and internal dependencies. Supports both default and named exports, and automatically handles primitive vs object default exports. Compatible with React and other transpiled environments.

total hits 25
actors 8 distinct systems
last hit 1d ago AhrefsBot
Amazonbot
4
MetaBot
4
ByteDance
3
GPTBot
2
Script
1
Search engines
1
Humans
2

top countries 🇺🇸 United States · 🇩🇪 Germany · 🇨🇦 Canada · 🇸🇬 Singapore · 🇬🇧 United Kingdom