Skip to content

[email protected] will cause every single file in the project to be watched #359

@foxted

Description

@foxted

Version

@nuxtjs/tailwindcss: 4.1.3
nuxt: 2.15.6
tailwind: >=2.1.3

Reproduction Link

No reproduction link but here's the tailwindcss PR that causes the problem: tailwindlabs/tailwindcss#4530

Steps to reproduce

Install a new project with @nuxtjs/tailwindcss and [email protected] or higher.

What is Expected?

Only the relevant project files are being watched and trigger a nuxt rebuild.

What is actually happening?

Any file in the project, including node modules, markdown files, github workflows, IDE specific files, anything is being watched and trigger a nuxt rebuild.


I think it comes from the new behaviour brought by this PR: tailwindlabs/tailwindcss#4530

This PR added a new "glob check" on paths provided to purge CSS. If the path is a glob, it will watch the directory instead.

Which is fine for these paths:

`${srcDir}/components/**/*.{vue,js,ts}`,
`${srcDir}/layouts/**/*.vue`,
`${srcDir}/pages/**/*.vue`,
`${srcDir}/plugins/**/*.{js,ts}`,

But this one is causing the issue:

`${rootDir}/nuxt.config.{js,ts}`

Tailwind will now consider this a glob and thus push the entire rootDir to be watched.

A potential quick fix for this would be to explicitly watch Javascript and Typescript config separately, to avoid tailwind thinking it must watch the whole directory:

`${rootDir}/nuxt.config.js`,
`${rootDir}/nuxt.config.ts`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions