-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Build Error: Selector ":root,:host" is not pure (nextjs/postcss) #16725
Comments
Seems like it is due to #16676, essentially:
Where the |
Thanks ! The comments suggest bug is fixed in 4.0.8 but thats the version I am using- do you know if the fix is supposed to be in 4.0.8? |
@gene-git Thanks for the bug report, we're looking into it. |
Thank you! |
same issue here. |
I did a quite a few things to solve the issue.. I think these were the ones the that fixed it. my issue seemed to be a CSS module that had an I commented those out as well as the
Ran the build and it seems to have fixed itself.. and was abe to uncomment ad build again. Hope this helps others. |
Got the same issue |
…larations (#16774) Fixes #16725 When using `@reference "tailwindcss";` inside a separate CSS root (e.g. Svelte `<style>` components, CSS modules, etc.), we have no guarantee that the CSS variables will be defined in the main stylesheet (or if there even is one). To work around potential issues with this we decided in #16676 that we would emit all used CSS variables from the `@theme` inside the `@reference` block. However, this is not only a bit surprising but also unexpected in CSS modules and Next.js that **requires CSS module files to only create scope-able declarations**. To fix this issue, we decided to not emit CSS variables but instead ensure all `var(…)` calls we create for theme values in reference mode will simply have their fallback value added. This ensures styles work as-expected even if the root Tailwind file does not pick up the variable as being used or _if you don't add a root at all_. Furthermore we do not duplicate any variable declarations across your stylesheets and you still have the ability to change variables at runtime. ## Test plan - Updated snapshots everywhere (see diff) - New Next.js CSS modules integration test
@gavan1 thank you very much for your help. i updated @tailwindcss/postcss and tailwindcss version 4.0.9 then this problem solved. |
@philipp-spiess thank you. Confirm 4.0.9 resolves this issue. |
Oh yeah sorry forgot to post an update here but this should be resolved now with the latest patch release 👍 |
versions:
While I have not changed any code of mine, it is always possible there's something I am not doing correctly. That said here's what I am seeing.
Issue:
Our current production server is running tailwindcss 4.0.6 and postcss 8.5.2 with same versions of next and react and builds and runs without problems.
After updating to above versions, I am now getting this error when building
The file page.module.css is the file imported to provide css everwhere.
It contains:
globals.css contains:
When running dev using updated packages, it seems to work fine but when building for production it generates this error:
The text was updated successfully, but these errors were encountered: