babel-plugin-forbidden-imports

Forbidden using import/require expression in your files

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-forbidden-imports
100.1.26 years ago6 years agoMinified + gzip package size for babel-plugin-forbidden-imports in KB

Readme

babel-plugin-forbidden-imports

Build Status NPM Dependencies License
This is a Babel plugin for static import/require modules checking. Any imported modules (using import or require) by default are forbidden. This plugin can be helpful in situations when you want to forbidden using specific modules in your environment.
Installation
Install via npm.
npm install --save-dev babel-plugin-forbidden-imports
Configuration
Configure it in your babelrc file (.babelrc).
{
  "env": {
    "node": {
      "plugins": [
        [
          "babel-plugin-forbidden-imports",
          {
            allowedModules: ["./my-local-module", "lodash/*"]
          }
        ]
      ]
    }
  }
}

or use with babel-register
require('babel-register')({
  plugins: [
    [
      'babel-plugin-forbidden-imports',
      {
        allowedModules: ["./my-local-module", "lodash/*"]
      }
    ]
  ]
});

License

MIT License