throw errors if certain packages/directories are imported from
npm install babel-plugin-forbid-imports




throw errors if certain packages/directories are imported from
I created this to automatically check whether client code in a webapp project
accidentally imports from server code.
```
npm install --save-dev babel-plugin-forbid-imports
An array of packages to forbid importing from.
`json`
{
"plugins": [
[
"babel-plugin-forbid-imports",
{
"packages": ["sequelize"]
}
]
]
}
An array of regular expression patterns. Any imports matching one of these
patterns will be forbidden. Each pattern can be a string or an array of
[pattern, flags].
`json`
{
"plugins": [
[
"babel-plugin-forbid-imports",
{
"patterns": ["\\d", ["foo", "i"]]
}
]
]
}
An array of paths to files or directories (relative to the babel cwd) to forbid
importing from. Subfiles and subdirectories are also forbidden.
`json``
{
"plugins": [
[
"babel-plugin-forbid-imports",
{
"paths": ["./src/server"]
}
]
]
}