Skip to content

Major 5.2.0 regression: no longer loads tailwind config by default #500

@bmulholland

Description

@bmulholland

Version

@nuxtjs/tailwindcss: 5.2.0
nuxt: 2. it would be nice if the template suggested an easy way to see this

This was highly annoying to debug -- see below -- and is a major regression.

Prior to version 5.2.0, my tailwind config was loaded automatically. As of 5.2.0, it only gets loaded if I add to my nuxt config tailwindcss: { configPath: '~/tailwind.config.js' },

Here's the line that broke it: https://github.com/nuxt-community/tailwindcss-module/pull/483/files#diff-030fc083b2cbf5cf008cfc0c49bb4f1b8d97ac07f93a291d068d81b4d1416f70R32


Now, here's the thing: when tailwind stops loading its config, it gives errors about completely unrelated things.

Upgrading to version 5.2.0 starts bringing up a new error:

Syntax Error: SyntaxError                                                                      friendly-errors 12:40:53

(36:0) .../layouts/default.vue The `text-navy` class does not exist. If `text-navy` is a custom class, make sure it is defined within a `@layer` directive.

  34 | body {
  35 |   @apply font-sans;
> 36 |   @apply text-navy;
     |                                       ^
  37 |   @apply bg-white;
  38 | }

Now, if you go looking for that error, you'll find stuff like this:

  1. [Utility class] class doesn't exist. If [Utility class] is a custom class, make sure it is defined within a @layer directive. tailwindlabs/tailwindcss#7055
  2. https://tailwindcss.com/docs/functions-and-directives#using-apply-with-per-component-css

And then you'll spend hours hunting down why you need to worry about apply when you haven't used that at all.

In my example above, text-navy is indeed a custom class, but it's defined by my tailwind config. There's no indication that my config isn't being loaded anymore, just that crash above.

To diagnose this, I manually upgraded every sub-package of 5.2.0, such that my yarn.lock was at the exact delta that the branch to upgrade @nuxtjs/tailwindcss to 5.2.0 had (even @types!), except for this package. Then I upgraded 5.2.0. that confirmed it was this package specifically. Then I hunted through all the details of the release, formed a hunch, and tested it.

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