babel-plugin-rewire
JSON →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.
Traffic · last 30 days ↓12% vs prev 7d
total hits 25
actors 8 distinct systems
last hit 1d ago AhrefsBot
top countries 🇺🇸 United States · 🇩🇪 Germany · 🇨🇦 Canada · 🇸🇬 Singapore · 🇬🇧 United Kingdom
Resources
API endpoints
full doc /v1/registry/babel-plugin-rewire
compatibility /v1/registry/babel-plugin-rewire/compatibility