Skip to content

Jit crash with comment in @layer utilities #5851

@targos

Description

@targos

What version of Tailwind CSS are you using?

v2.2.17

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

Vite 2.6.7

What version of Node.js are you using?

For example: v16.11.0

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction URL

N/A

Describe your issue

With the following tailwind.css file, Jit mode crashes because of the "hello" comment:

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
  /* hello */
  .test {
    color: red;
  }
}

It is important to reproduce the crash that the comment be inside the @layer utilities block, just before a selector.

Stack trace:

rule.walkDecls is not a function
      at /Users/targos/test/node_modules/tailwindcss/lib/jit/lib/generateRules.js:338:14
      at Array.map (<anonymous>)
      at generateRules (/Users/targos/test/node_modules/tailwindcss/lib/jit/lib/generateRules.js:330:27)
      at /Users/targos/test/node_modules/tailwindcss/lib/jit/lib/expandTailwindAtRules.js:186:50
      at /Users/targos/test/node_modules/tailwindcss/lib/jit/processTailwindFeatures.js:60:49
      at /Users/targos/test/node_modules/tailwindcss/lib/jit/index.js:25:56
      at LazyResult.runOnRoot (/Users/targos/test/node_modules/postcss/lib/lazy-result.js:339:16)
      at LazyResult.runAsync (/Users/targos/test/node_modules/postcss/lib/lazy-result.js:391:26)
      at LazyResult.async (/Users/targos/test/node_modules/postcss/lib/lazy-result.js:221:30)
      at LazyResult.then (/Users/targos/test/node_modules/postcss/lib/lazy-result.js:206:17) (x3)

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