Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variants of @layer-provided utilities have incorrect source map locations #12464

Closed
sapphi-red opened this issue Nov 22, 2023 · 4 comments · Fixed by #12508
Closed

Variants of @layer-provided utilities have incorrect source map locations #12464

sapphi-red opened this issue Nov 22, 2023 · 4 comments · Fixed by #12508
Assignees

Comments

@sapphi-red
Copy link

sapphi-red commented Nov 22, 2023

What version of Tailwind CSS are you using?

v3.3.5

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

postcss 8.4.31

What version of Node.js are you using?

v20.9.0

What browser are you using?

N/A

What operating system are you using?

Windows

Reproduction URL

https://stackblitz.com/edit/node-xsqtyh?file=index.js,package.json

Describe your issue

Without tailwind, running postcss (+ autoprefixer) on the following content outputs a warning with { line: 8, column: 5, endLine: 8, endColumn: 25 }. This is the position of color-adjust: exact; which I expect.

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

@layer utilities {
  .foo {
    color-adjust: exact;
  }
}

But with tailwind, the position becomes { line: 1, column: 1, endLine: 11, endColumn: 2 }. This points the whole content. Also endLine: 11, endColumn: 2 is pointing the position out-of-bounds.
I expect tailwind to not to alter the warning position.

I found this while debugging vitejs/vite#15076.

@Spice-King
Copy link

Well, that explains why I could not make heads or tails of this while lacking experience with the code base. Two bugs stacking together. Thanks for the fix in Vite and finding the triggering issue here @sapphi-red.

@thecrypticace thecrypticace self-assigned this Nov 29, 2023
@thecrypticace thecrypticace changed the title Adding tailwind changes the position of warning to incorrect position Variants of @layer rules have incorrect source map locations Nov 29, 2023
@thecrypticace thecrypticace changed the title Variants of @layer rules have incorrect source map locations Variants of @layer-provided utilities have incorrect source map locations Nov 29, 2023
@thecrypticace
Copy link
Contributor

Looks like this only happens for variants of rules in an @layer. Looking into it!

@thecrypticace
Copy link
Contributor

Hey I've merged the fix for this in #12508 and it'll be available in our next release.

It'll also be available via our insiders build in about 15 minutes:

npm install tailwindcss@insiders

@sapphi-red
Copy link
Author

@thecrypticace
I ran the reproduction with 0.0.0-insiders.6dfcdd1.
The warning changed to

[
  {
    type: 'warning',
    text: 'Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.',
    line: 300,
    column: 5,
    endLine: 300,
    endColumn: 25,
    node: undefined,
    plugin: 'autoprefixer'
  }
]

I think the line number is still broken. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants