# babel-plugin-require-context-hook

> Babel plugin to replicate Webpack require.context

Latest version **1.0.0** (published 2018-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-require-context-hook
pnpm add babel-plugin-require-context-hook
yarn add babel-plugin-require-context-hook
bun add babel-plugin-require-context-hook
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-06-06 |
| First published | 2018-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Greg Smith |
| Maintainers | smrq |
| Keywords | babel, webpack |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-require-context-hook
- Repository: https://github.com/smrq/babel-plugin-require-context-hook
- Homepage: https://github.com/smrq/babel-plugin-require-context-hook#readme
- Issues: https://github.com/smrq/babel-plugin-require-context-hook/issues
- npm.io page: https://npm.io/package/babel-plugin-require-context-hook

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-06-06

## README

# babel-plugin-require-context-hook

## Usage

babelrc:

```
"plugins": [
	"require-context-hook"
]
```

Wherever you configure babel-register (your source file, a register script, etc):

```
require('babel-plugin-require-context-hook/register')();
```

## How it works

The register script `babel-plugin-require-context-hook/register` implements the function `require.context` with an extra parameter-- the directory in which the calling file resides-- and places that function on the global scope.

The Babel plugin `babel-plugin-require-context-hook` rewrites all calls to `require.context` into calls to this global function, passing in `__dirname` as the extra parameter.

---
_Source: https://npm.io/package/babel-plugin-require-context-hook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
