Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Scanner `globs` walks gitignored directories (files pass respects .gitignore, globs pass does not)

Open
#20,533 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@akasakariko is already working on this.

Since Oct 2, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, vite

Research direction

Start by running the self-contained repro.mjs and comparing the Scanner files and globs passes, then inspect the Scanner API and the oxide-helper.js integration mentioned in the report. Done means computing scanner.globs no longer traverses directories excluded by .gitignore, while the returned globs remain unchanged.

Written by the indexing model from the issue text.

Description

What version of Tailwind CSS are you using?

@tailwindcss/oxide 4.3.3 (same behaviour in 4.1.14)

What build tool (or framework if it abstracts the build tool) are you using?

@tailwindcss/vite; also reproduced with the JetBrains Tailwind CSS plugin (its oxide-helper.js) and with the Scanner API directly.

What version of Node.js are you using?

v24.18.1

What operating system are you using?

Linux (btrfs)

Reproduction

Self-contained script, no project needed:

// repro.mjs — run: strace -f -e trace=statx,openat -o trace.log node repro.mjs && grep -c 'repo/var/cache' trace.log
import { createRequire } from 'node:module';
import { mkdirSync, writeFileSync } from 'node:fs';
import { execSync } from 'node:child_process';

const require = createRequire(import.meta.url);
const { Scanner } = require('@tailwindcss/oxide');

const root = '/tmp/oxide-repro/repo';
mkdirSync(`${root}/var/cache/profiler/aa`, { recursive: true });
mkdirSync(`${root}/templates`, { recursive: true });
writeFileSync(`${root}/.gitignore`, '/var/\n');
writeFileSync(`${root}/templates/page.html`, '<div class="flex"></div>');
writeFileSync(`${root}/var/cache/profiler/aa/bb1234`, '<div class="grid"></div>');
execSync('git init -q', { cwd: root });

const scanner = new Scanner({ sources: [{ base: root, pattern: '**/*', negated: false }] });
console.log('files:', scanner.files);  // correct: only templates/page.html
console.log('globs:', scanner.globs);  // correct result, but computing it walks var/

Describe your issue

Auto source detection respects .gitignore when building scanner.files, but computing scanner.globs walks into gitignored directories anyway. The returned globs are correct (the ignored folder is not in them), so the problem is purely the traversal.

From the strace of the script above:

  • The files pass opens var/, checks var/.gitignore, var/.ignore and var/.git/info/exclude, then stops. That's correct.
  • The globs pass then opens var/, var/cache, var/cache/profiler, var/cache/profiler/aa and stats every file inside. No ignore file is consulted on this pass.

With a large ignored directory this is very costly. In our case it was a Symfony var/cache/dev/profiler with ~13M small files:

  • vite build hung for 20+ minutes in read_extent_buffer_pages, single-threaded on the main thread while reading globs.
  • The JetBrains Tailwind helper kept spinning at 15–25% CPU per process. It always adds { base: <project root>, pattern: '**/*' }, so the walk happens whatever the CSS says.

scanner.files alone, on the same real project, returns in well under a second (3,299 files) and never touches the ignored folder.

Workaround

@import "tailwindcss" source(none); plus explicit @source paths avoids the root scan for the build. It doesn't help IDE integrations that hard-code a root source.

Possibly related: #20385 / #20397. That's a different trigger (allow-list .gitignore); here the .gitignore is a plain /var/.

Dominant language
TypeScript
Stars
97.9k
Forks
8.3k
Avg merge
2d 19h
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tailwindlabs/tailwindcss

All issues in tailwindlabs/tailwindcss

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.