Build plugin to restrict import patterns in certain parts of your code-base.
This package is an unplugin which provides support for a wide range of bundlers.
Install package:
# npm
npm install impound
// rollup.config.js
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { ImpoundPlugin } from 'impound'
export default {
plugins: [
ImpoundPlugin.rollup({
cwd: dirname(fileURLToPath(import.meta.url)),
include: [/src\/*/],
patterns: [
[/^node:.*/], // disallows all node imports
['@nuxt/kit', 'Importing from @nuxt kit is not allowed in your src/ directory'] // custom error message
]
}),
],
}
- Clone this repository
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
Made with ❤️
Published under MIT License.