diff --git a/src/index.ts b/src/index.ts index 99198e0..745bf68 100644 --- a/src/index.ts +++ b/src/index.ts @@ -289,8 +289,8 @@ export default (opts: PluginOptions = {}): Plugin => { } const isIncludedRelative = getIncluder( - config.include?.map((p) => relative(configDir, p)), - config.exclude?.map((p) => relative(configDir, p)), + config.include?.map((p) => ensureRelative(configDir, p)), + config.exclude?.map((p) => ensureRelative(configDir, p)), outDir ) @@ -409,3 +409,7 @@ function compileGlob(glob: string) { globstar: true, }).regex } + +function ensureRelative(dir: string, path: string) { + return isAbsolute(path) ? relative(dir, path) : path +}