nuxt-modules / tailwindcss

Tailwind CSS module for Nuxt
https://tailwindcss.nuxtjs.org
MIT License
1.67k stars 179 forks source link

No utility classes were detected in your source files, despite clearly having set utility classes. #893

Closed rylanharper closed 1 month ago

rylanharper commented 1 month ago

Environment

Reproduction

This package has always been working well for me, but last night I installed @nuxtjs/tailwindcss on a new project and noticed some errors/warnings, despite the module being define in my nuxt.config.

I get the following errors:

No utility classes were detected in your source files. If this is unexpected, double-check the content option in your Tailwind CSS configuration.

On top of this, in my tailwind.config.ts file, tailwindcss states that Cannot find module 'tailwindcss' or its corresponding type declarations.ts

import defaultTheme from 'tailwindcss/defaultTheme' // Cannot find module 'tailwindcss/defaultTheme' or its corresponding type declarations.
import type { Config } from 'tailwindcss' // Cannot find module 'tailwindcss' or its corresponding type declarations.ts

export default <Partial<Config>>{
  theme: {
    extend: {
      screens: {
        '3xl': '1920px'
      },
      fontFamily: {
        sans: ['IBM Plex Sans', ...defaultTheme.fontFamily.sans],
        mono: ['IBM Plex Mono', ...defaultTheme.fontFamily.mono]
      }
    }
  }
}

Here is a Stackblitz of the issue (check the console), although I cannot seem to get the tailwind.config.ts TypeScript warnings to show up (but it is on my project).

Describe the bug

The @nuxtjs/tailwindcss should recognize the default tailwind utility classes and type imports.

Additional context

Should also be noted that I am using pnpm for my personal project, but the issue does seem to appear when using npm on Stackblitz

Logs

No response

ineshbose commented 1 month ago

Duplicate - https://github.com/nuxt-modules/tailwindcss/issues/574

This is an intentional message from tailwindcss core when no utility classes are found in your source files yet: https://github.com/tailwindlabs/tailwindcss/blob/89f0f54751639db11affc4f60592002ef14c7ed6/src/lib/expandTailwindAtRules.js#L276