webpack/css-loader

Pure selector mistaken as not pure

Closed this issue · 2 comments

Bug report

Actual Behavior

I'm using next 14.1.0, so I'm not 100% sure if this issue is css-loader's fault, so I apologize in advance. Here's the thing:

I understand next 14.1.0 is using css-loader in pure mode, and thus you cannot use selectors such as span or body directly. But it is allowed to do .someClassname > span.

The problem is that I think this should be allowed, since it's an equivalent of .someClassname > span

.someClassname {
  ...someStyles

   & > span {
      ...someOtherStyles
   }
}

But it is throwing an error Selector "& > span" is not pure

Expected Behavior

Since the "invalid" nested version and the "valid" version are equivalent, it should allow to use both

How Do We Reproduce?

.test {
    color: red;

    & > span {
        color: green;
    }
}

Already fixed before , please ask next-js team to update css-loader or own deps

css-modules/postcss-modules-local-by-default@a8c3d77
6515be0

Thanks, I'll ping them!