Repository: tailwindlabs/tailwindcss
File: packages/@tailwindcss-postcss/src/index.ts (TypeScript)

Code before:
            })().concat(context.compiler.globs)

            // Look for candidates used to generate the CSS
            context.scanner = new Scanner({ sources })
          }

          env.DEBUG && console.time('[@tailwindcss/postcss] Scan for candidates')
          let candidates = context.scanner.scan()
          env.DEBUG && console.timeEnd('[@tailwindcss/postcss] Scan for candidates')

          // Add all found files as direct dependencies
          for (let file of context.scanner.files) {
            result.messages.push({
              type: 'dependency',
              plugin: '@tailwindcss/postcss',
              file,
              parent: result.opts.from,
            })
          }

          // Register dependencies so changes in `base` cause a rebuild while
          // giving tools like Vite or Parcel a glob that can be used to limit
          // the files that cause a rebuild to only those that match it.
          for (let { base: globBase, pattern } of context.scanner.globs) {
            // Avoid adding a dependency on the base directory itself, since it
            // causes Nextjs to start an endless recursion if the `distDir` is
            // configured to anything other than the default `.next` dir.
            if (pattern === '*' && base === globBase) {
              continue
            }

            if (pattern === '') {
              result.messages.push({
                type: 'dependency',
                plugin: '@tailwindcss/postcss',
                file: globBase,
                parent: result.opts.from,
              })
            } else {
              result.messages.push({
                type: 'dir-dependency',
                plugin: '@tailwindcss/postcss',
                dir: globBase,
                glob: pattern,
                parent: result.opts.from,
              })
            }
          }

          env.DEBUG && console.time('[@tailwindcss/postcss] Build CSS')
          css = context.compiler.build(candidates)

Review comment (suggestion):
```suggestion
            // causes Next.js to start an endless recursion if the `distDir` is
```

Code after:
            })().concat(context.compiler.globs)

            // Look for candidates used to generate the CSS
            context.scanner = new Scanner({ sources })
          }

          env.DEBUG && console.time('[@tailwindcss/postcss] Scan for candidates')
          let candidates = context.scanner.scan()
          env.DEBUG && console.timeEnd('[@tailwindcss/postcss] Scan for candidates')

          // Add all found files as direct dependencies
          for (let file of context.scanner.files) {
            result.messages.push({
              type: 'dependency',
              plugin: '@tailwindcss/postcss',
              file,
              parent: result.opts.from,
            })
          }

          // Register dependencies so changes in `base` cause a rebuild while
          // giving tools like Vite or Parcel a glob that can be used to limit
          // the files that cause a rebuild to only those that match it.
          for (let { base: globBase, pattern } of context.scanner.globs) {
            // Avoid adding a dependency on the base directory itself, since it
            // causes Next.js to start an endless recursion if the `distDir` is
            // configured to anything other than the default `.next` dir.
            if (pattern === '*' && base === globBase) {
              continue
            }

            if (pattern === '') {
              result.messages.push({
                type: 'dependency',
                plugin: '@tailwindcss/postcss',
                file: globBase,
                parent: result.opts.from,
              })
            } else {
              result.messages.push({
                type: 'dir-dependency',
                plugin: '@tailwindcss/postcss',
                dir: globBase,
                glob: pattern,
                parent: result.opts.from,
              })
            }
          }

          env.DEBUG && console.time('[@tailwindcss/postcss] Build CSS')
          css = context.compiler.build(candidates)