diff --git a/README.md b/README.md index 864f415..fe6df3d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Github Actions][github-actions-src]][github-actions-href] [![Codecov][codecov-src]][codecov-href] -> Builder-agnostic plugin to allow restricting import patterns in certain parts of your code-base. +> Build plugin to restrict import patterns in certain parts of your code-base. This package is an [unplugin](https://unplugin.unjs.io/) which provides support for a wide range of bundlers. @@ -21,12 +21,13 @@ npm install impound ```js // rollup.config.js import { dirname } from 'node:path' +import { fileURLToPath } from 'node:url' import { ImpoundPlugin } from 'impound' export default { plugins: [ ImpoundPlugin.rollup({ - cwd: dirname(import.meta.url), + cwd: dirname(fileURLToPath(import.meta.url)), include: [/src\/*/], patterns: [ [/^node:.*/], // disallows all node imports diff --git a/playground/index.js b/playground/index.js index e8eced0..76cb014 100644 --- a/playground/index.js +++ b/playground/index.js @@ -1,4 +1,5 @@ import { dirname } from 'node:path' +import { fileURLToPath } from 'node:url' import { ImpoundPlugin } from 'impound' import { rollup } from 'rollup' @@ -6,7 +7,7 @@ await rollup({ input: 'src/index.js', plugins: [ ImpoundPlugin.rollup({ - cwd: dirname(import.meta.url), + cwd: dirname(fileURLToPath(import.meta.url)), include: [/src\/*/], patterns: [ [/^node:.*/], // disallows all node imports