Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#20,533 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@akasakariko ci sta già lavorando.

Dal 2/10/2026.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, vite

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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/.

Lingua principale
TypeScript
Stelle
97.9k
Fork
8.9k
Merge medio
2g 19h
PR unite (30g)
24

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tailwindlabs/tailwindcss

Tutte le issue di tailwindlabs/tailwindcss

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.