# @storybook/babel-plugin-require-context-hook

> Babel plugin to replicate Webpack require.context

Latest version **1.0.1** (published 2021-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @storybook/babel-plugin-require-context-hook
pnpm add @storybook/babel-plugin-require-context-hook
yarn add @storybook/babel-plugin-require-context-hook
bun add @storybook/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.1 |
| Published | 2021-11-11 |
| First published | 2021-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Greg Smith |
| Maintainers | kylegach, tooppaaa, ndelangen, shilman, alexandrebodin, hypnosphi, danielduan, igor-dv, pksunkara, tmeasday, gongreg, domyen, usulpro, kylesuss, ghengeveld, pago, dandean, codebyalex, mrmckeb, dannyhw, winkervsbecks, rvasikarla, amalik2, lshadler, phated, yannbf, dylanpiercey, monkeyworks, darleendenno |
| Keywords | babel, webpack |

## Links

- npm: https://www.npmjs.com/package/@storybook/babel-plugin-require-context-hook
- Repository: https://github.com/storybookjs/babel-plugin-require-context-hook
- Homepage: https://github.com/storybookjs/babel-plugin-require-context-hook#readme
- Issues: https://github.com/storybookjs/babel-plugin-require-context-hook/issues
- npm.io page: https://npm.io/package/@storybook/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.1 (latest) — 2021-11-11
- 1.0.1--canary.4.86c1352.0 (canary) — 2021-11-11

## README

# babel-plugin-require-context-hook

> NOTE: This is a (hopefully temporary) fork of [babel-plugin-require-context-hook](https://github.com/smrq/babel-plugin-require-context-hook), which appears to be unmaintained.

## Usage

In your babelrc:

```
"plugins": [
	"@storybook/babel-plugin-require-context-hook"
]
```

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

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

## How it works

The register script `@storybook/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 `@storybook/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/@storybook/babel-plugin-require-context-hook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
