You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@vanilla-extract/babel-plugin-debug-ids fails to generate consistent debug identifiers for createTheme between server and client environments when run in next dev. The code generated for the server will correctly generate the debug id as theme_createThemeClass__XXXXXXXX. The code generated on for client however will generate a debug id of theme_ref__XXXXXXXX. This means that the generated style sheet has a different class than the class that is applied to the element, causing styles to fail and a Next.js client/server mismatch.
The issue involves this section in @vanilla-extract/babel-plugin-debug-ids that is responsible for handling a specific export format of createTheme. This code only handles one scenario:
I believe this issue arrose in @vanilla-extract/integration@6.0.0 as part of the removal of @vanilla-extract/babel-plugin in #827. I'm not exactly sure what is causing the compiled code to change structure though, potentially something in Next.js' SWC compilation process?
TL;DR: @vanilla-extract/babel-plugin-debug-ids needs to be updated to handle a wider range of scenarios for createTheme.
Describe the bug
@vanilla-extract/babel-plugin-debug-ids
fails to generate consistent debug identifiers forcreateTheme
between server and client environments when run innext dev
. The code generated for the server will correctly generate the debug id astheme_createThemeClass__XXXXXXXX
. The code generated on for client however will generate a debug id oftheme_ref__XXXXXXXX
. This means that the generated style sheet has a different class than the class that is applied to the element, causing styles to fail and a Next.js client/server mismatch.The issue involves this section in
@vanilla-extract/babel-plugin-debug-ids
that is responsible for handling a specific export format ofcreateTheme
. This code only handles one scenario:when it's compiled to:
But if you look at the generated code output by Next.js' SWC, it is actually:
And if the consumer instead uses:
then there is yet another compiled permutation:
I believe this issue arrose in
@vanilla-extract/integration@6.0.0
as part of the removal of@vanilla-extract/babel-plugin
in #827. I'm not exactly sure what is causing the compiled code to change structure though, potentially something in Next.js' SWC compilation process?TL;DR:
@vanilla-extract/babel-plugin-debug-ids
needs to be updated to handle a wider range of scenarios forcreateTheme
.Reproduction
https://github.com/zbauman3/demos/tree/vanilla-extract-next-dev
System Info
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: