Skip to content

Bug: Detecting classes in source files causes crash #17054

Closed
@Autumnal-Joy

Description

@Autumnal-Joy

What version of Tailwind CSS are you using?

4.0.11

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

"next": "15.2.2-canary.3"

What version of Node.js are you using?

v20.18.0

What browser are you using?

Chrome

What operating system are you using?

Windows

Reproduction URL

https://github.com/Autumnal-Joy/tailwindcss-bug-reproduce

Describe your issue

Crash

const c = "#52d71e";
console.log(`bg-[${c}]`);
 ⨯ ./app/globals.css:485:25
Parsing css source code failed
  483 |   }
  484 |   .bg-\[\$\{c\}\] {
> 485 |     background-color: ${c};
      |                         ^
  486 |   }
  487 |   .bg-background {
  488 |     background-color: var(--background);

I saw the documentation saying that "Don't use props to build class names dynamically", but ​It seems a bit unconventional that console.log could also cause a crash.

Metadata

Metadata

Assignees

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