Skip to content

postcss-is-pseudo-class: Complex selectors in ':global :is(...)' can not be transformed to an equivalent selector without ':is()' #2722

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

Closed
simPod opened this issue Aug 29, 2022 · 14 comments

Comments

@simPod
Copy link

simPod commented Aug 29, 2022

I'm getting a lot of warnings from postcss of graphiql/graphiql.css

(794:1) postcss-is-pseudo-class: Complex selectors in ':global :is(.graphiql-markdown-deprecation, .CodeMirror-hint-information-deprecation-reason, .CodeMirror-info .info-deprecation) code, :global :is(.graphiql-markdown-deprecation, .CodeMirror-hint-information-deprecation-reason, .CodeMirror-info .info-deprecation) pre' can not be transformed to an equivalent selector without ':is()'.

(v2)

@thomasheyenbrock
Copy link
Collaborator

Hey @simPod 👋 can you give more context here about your setup and when you are seeing these warnings?

@simPod
Copy link
Author

simPod commented Aug 30, 2022

I'm using webpack. Followed readme

import { createGraphiQLFetcher } from '@graphiql/toolkit';
import { GraphiQL } from 'graphiql';
import React from 'react';
import ReactDOM from 'react-dom';

import 'graphiql/graphiql.css';

const fetcher = createGraphiQLFetcher({
  url: 'https://my.backend/graphql',
});

ReactDOM.render(<GraphiQL fetcher={fetcher} />, document.body);

but all my css is post processed using postcss:

{ loader: 'postcss-loader', options: postcssConfig }
const postcssConfig = {
  postcssOptions: { plugins: ['postcss-preset-env'] },
  sourceMap: true,
};

so I'm seeing it during build.

@jonathanawesome
Copy link
Collaborator

@simPod doing some pruning...are you still having issues with your setup?

@simPod
Copy link
Author

simPod commented Nov 15, 2022

Yes, using 2.1.0

@thomasheyenbrock
Copy link
Collaborator

@simPod I tried to reproduce it in the webpack example of our repo, but didn't manage to with the PostCSS config you posted. Can you provide us with a running reproduction (a repo that we can clone, StackBlitz, CodeSandbox, etc) so that we can further look into this?

@simPod
Copy link
Author

simPod commented Dec 11, 2022

@arthurthefourth
Copy link

Having the same issue. Here's a minimal repo that gives me dozens of these warnings when I run yarn build. https://github.com/arthurthefourth/pseudo-class-test. I'm no Webpack expert, so it's possible I've got something configured wrong, but I tried to set it up as simply as possible.

Thanks for taking a look!

@arthurthefourth
Copy link

If it's helpful, I believe what's happening here is that postcss-preset-env is just unable to polyfill certain types of complex selectors with certain pseudo-classes, which GraphiQL's CSS uses.

By default, postcss-preset-env tries to support features that are Stage 2 and below (which includes is-pseudo-class), and uses the Browserslist defaults to determine whether a feature needs to be polyfilled.

The default browsers almost entirely includes browsers that support is-pseudo-class, except for Opera Mini.

So really this is a bug in Opera Mini. 😉

@simPod
Copy link
Author

simPod commented Mar 5, 2023

I don't see the issue on v2.4.0

@dimaMachina
Copy link
Collaborator

@simPod I will close since problem was resolved

@simPod
Copy link
Author

simPod commented May 28, 2023

Not sure if this #2722 (comment) was true since I can see those warnings on latest.

But I'm using webpack.ignoreWarnings to suppress those.

@dimaMachina dimaMachina reopened this May 28, 2023
@dimaslanjaka
Copy link

same here when using flowbite and tailwind in webpack

@sbaechler
Copy link

It looks like this is a problem with postcss-preset-env. Adding

"not dead",
"not op_mini all"

to my browserslist config solved it for me.

brycewray added a commit to brycewray/hugo-site that referenced this issue Nov 25, 2024
@dimaMachina
Copy link
Collaborator

Fixed by upgrading Vite to v6 and using Lightningcss instead Postcss, check out the migration guide for more info.

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

No branches or pull requests

7 participants