Skip to content

Suspected false positive circular dependency detection #7373

@LeoniePhiline

Description

@LeoniePhiline

What version of Tailwind CSS are you using?

3.0.19

What build tool (or framework if it abstracts the build tool) are you using?

parcel 2.2.1 with

  • @parcel/config-default
  • @parcel/core
  • @parcel/optimizer-css
  • @parcel/transformer-css-experimental (= @parcel/css)
  • @parcel/transformer-postcss

What version of Node.js are you using?

16.13.2

What operating system are you using?

OpenSUSE Tumbleweed

Reproduction URL

https://play.tailwindcss.com/d2XQQecVBx?file=css

Note how the error is reported for line 17 in tailwind play (link above), although the @apply bg-magenta is entirely somewhere else. (Further down below, at .rte th.)

Describe your issue

I have found a false positive. (Slipped through #6588.)

The following worked in TailwindCSS 2, but is broken in TailwindCSS 3:

/** base/rte/hyperlinks.css **/
@layer base {

   .rte a[href]:not(.cta) {
     @apply text-magenta; /* Note: text-magenta, not bg-magenta. */
   }

    /* 
     * False error in next selector below: 
     * You cannot @apply the bg-magenta utility here because it creates a circular dependency. 
     */

   .bg-magenta.text-white .rte a[href]:not(.cta) { /* line 11, originally. Line 17 in https://play.tailwindcss.com/d2XQQecVBx?file=css */
       color: theme('colors.white');
   }

}

/** base/rte/tables.css **/
@layer base {

  .rte th {
    @apply bg-magenta text-white; /* This appears to actually trigger the circular dependency. Should it, though? I believe this is a false positive. */
  }
  
}

I get the following error reported:

@parcel/transformer-postcss:
/src/tailwind/custom/base/rte/hyperlinks.css:11:4:
You cannot @apply the bg-magenta utility here because it creates a circular dependency.

In https://play.tailwindcss.com/d2XQQecVBx?file=css if you remove bg-magenta from .rte th, then the error message reads:

Line 17: You cannot @apply the text-white utility here because it creates a circular dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions