-
Notifications
You must be signed in to change notification settings - Fork 3
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
Styles extraction doesn't work in server components (Workaround Available~! See comments) #1
Comments
This comment was marked as outdated.
This comment was marked as outdated.
After discussing with @shuding (Next.js Team Member), he is able to pinpoint where Next.js drop all the loaders: Here, only In the meantime, |
@SukkaW Here is a very basic reproduction with [email protected]: |
Thanks for your feedback! In the meantime, I will keep the issue open. Once Next.js has fixed that part of its internal implementation, I will add a deprecation/removal warning in |
Hey @SukkaW, Here is a basic reproduction: Update: |
Actually, the issue should have happened since Next.js 13.4.19, when Next.js removes the Here is the related fix that has landed in |
This actually happened after updating Next JS from "13.4.19" to "13.5.4". The previous version didn't have this problem. |
Maintainer Edits/Notes:
For those who want to use style9 in Next.js 13's
appDir
+ Server Components, usestyle9-webpack/next-appdir
instead ofstyle9-webpack/next
for now.For those who want to know why
style9
might not work with Next.js 13'sappDir
, check out https://github.com/SukkaW/style9-webpack#motivation and #1 (comment)The plugin seems to work great with client components in the
app
dir, but not in server components.Here is a very basic reproduction:
https://codesandbox.io/p/sandbox/ew8bdq
Can you spot anything wrong with our setup?
From the testing we've done, it would seem like Style9 itself works fine. If a server component uses a class that is also used in a client component (e.g., both use
color: green;
), the server component has the correct class and is painted green. However, if the server component uses a style that isn't used in any client component, saycolor: gold;
, it will have a class on it that does not exist in the extracted css file.The text was updated successfully, but these errors were encountered: