esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

Allow media queries nested in pseudo element selectors

Open EECOLOR opened this issue 9 months ago • 1 comments

Fixes: https://github.com/evanw/esbuild/issues/4164

Please note that I used AI to create the solution. From what I can tell from my limited understanding of Go this solution makes sense. What I can not determine:

  • Is the function I added the best way of achieving this result?
  • Is this in line with your style of writing Go?
  • Should the function be in that specific file?
  • Did I miss any test cases for subtle interaction with other features?

This change fixes the following use case:

input

a {
  &::before {
    @media screen {
      ...
    }
  }
}

before

@media screen {
  {
    ...
  }
}

after

@media screen {
  &::before {
    ...
  }
}

EECOLOR avatar May 08 '25 09:05 EECOLOR

@evanw Any chance you can review this?

EECOLOR avatar May 27 '25 14:05 EECOLOR

Annoying bug, I also have the same problem in my project, so it would be great to see a fix finally implemented. Thanks @EECOLOR for explaining the source of the problem.

bronisMateusz avatar Jun 09 '25 10:06 bronisMateusz

I'm closing this because I believe it was fixed by the fix for #4265, which was released in version 0.25.10.

evanw avatar Oct 30 '25 16:10 evanw

@evanw Thanks! As soon as I have time I will verify it. https://github.com/evanw/esbuild/issues/4164 has a more complete test case, so if it indeed fixes that problem I will close that ticket as well.

I will let you know if it does not solve the problem.

EECOLOR avatar Oct 31 '25 07:10 EECOLOR