babel-plugin-transform-require-context

A [Babel](http://babeljs.io) plugin that transforms [webpack](https://webpack.js.org/)-specific `require.context()` into dummy function calls so that the code can run safely outside of the webpack environment, e.g. in Node. It doesn't perform any file l

MIT License

Downloads
278.2K
Stars
8
Committers
2

babel-plugin-transform-require-context

A Babel plugin that transforms webpack-specific require.context() into dummy function calls so that the code can run safely outside of the webpack environment, e.g. in Node. It doesn't perform any file lookup or dynamic require, but should not break the code otherwise.

Installation

$ npm install babel-plugin-transform-require-context

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-require-context"]
}

Via CLI

$ babel --plugins transform-require-context script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["transform-require-context"]
});
Package Rankings
Top 4.68% on Npmjs.org
Badges
Extracted from project README
NPM Downloads
Related Projects