Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

Package Overview
Dependencies
Maintainers
29
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Babel plugin to replicate Webpack require.context

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
29
Created
Source

babel-plugin-require-context-hook

NOTE: This is a (hopefully temporary) fork of 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.

Keywords

FAQs

Package last updated on 11 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc