babel-plugin-require-context-hook

1.0.0 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    234,372
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    234,372

Package Sidebar

Install

npm i babel-plugin-require-context-hook

Weekly Downloads

234,372

Version

1.0.0

License

MIT

Unpacked Size

3.43 kB

Total Files

9

Last publish

Collaborators

  • smrq