Skip to content

Commit

Permalink
fix: glob compiling for include/exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Dec 7, 2022
1 parent dd191a1 commit 86a9c93
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.ts
Expand Up @@ -335,11 +335,15 @@ function getIncluder(
function addCompiledGlob(this: RegExp[], glob: string) {
const endsWithGlob = glob.split('/').pop()!.includes('*')
const relativeGlob = relativeImportRE.test(glob) ? glob : './' + glob
if (!endsWithGlob) {
this.push(compileGlob(relativeGlob + '/**'))
}
if (jsLikeRE.test(glob)) {
if (endsWithGlob) {
this.push(compileGlob(relativeGlob))
} else {
// Append a globstar to possible directories.
this.push(compileGlob(relativeGlob + '/**'))
// Try to match specific files (must have file extension).
if (/\.\w+$/.test(glob)) {
this.push(compileGlob(relativeGlob))
}
}
}

Expand Down

0 comments on commit 86a9c93

Please sign in to comment.