Babel Plugin Require Context Hook

JSON →
library 1.0.0 ·javascript
verified May 27, 2026

A Babel plugin that replicates Webpack's require.context() for use in Node.js environments, primarily with Mocha tests or scripts. Current stable version 1.0.0. It rewrites require.context calls into a global function provided by a helper register script. Unlike alternatives (e.g., mock-require-context), this plugin uses a Babel transform to inject __dirname into the context, making it work seamlessly with babel-register. It has no runtime dependencies.

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

top countries 🇺🇸 United States · 🇩🇪 Germany · 🇸🇬 Singapore · 🇨🇦 Canada · 🇫🇷 France