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.
Install via npm.
npm install --save-dev babel-plugin-forbidden-imports
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/*"]
}
]
]
});