Replies: 3 comments 2 replies
-
|
Alright.... So for colors, I was importing an mq like this // mqs.stylex.ts
import { css } from "react-strict-dom";
export const mqs = css.defineConsts({
media_dark: "@media (prefers-color-scheme: dark)",
supports_okhsl: "@supports (color: oklch(0% 0 0))",
});// colors.stylex.ts
import { mqs } from "@/shared/styles/tokens/mqs.stylex";
// then later in css.create
{
default: "...",
[mqs.media_dark]: "...",
}Not importing the mq and having it directly in the file solved the entire problem... That's weird and unexpected. |
Beta Was this translation helpful? Give feedback.
-
|
This might be an issue with StyleX and worth reporting there. Meta has had a few issues internally where dev/prod CSS order is different too |
Beta Was this translation helpful? Give feedback.
-
|
I am having various problems, kind of "more and more" this days. Not sure what part is really the culprit in my setup. The thing I can easily see is that generated html/dom have some classes that are missing in the generated css in my nextjs setup. I have found some issue in stylex repo about nextjs issues, but all are closed, apparently for good reasons. I have a repo that I cannot share publicly where an inconsistency is visible in production (Vercel) and locally, but I am pretty sure if I spend some times to extract some part, the bug will go away. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following simple styles
Then in actual styles
(I simplified but I have also lineHeight & fontWeight etc)
This works properly during development with
next dev. The generated CSS is as I would expect and look to something like this:Problem is: when building my app with
next exportfor production (static app), the generated css is different, thus the render as wellI have simplified the output of course, but you can see that media query is before the
default. So all my font size supposed to be different on mobile and desktop (different font size) aren't. The default font size takes precedence, and the mq is ignored.I have compared my entire generated CSS and that's the only diff I have... Check out the full online diff here
https://www.diffchecker.com/h2Bimv5x/
next dev or export both use the same next config except one use turbopack and export rely on webpack, but the exact same babel loader are used (same function from the same file - as visible in current RSD Next setup docs).
Edit: I have the same problem with the following
Which in dev, works perfectly as expected, but when exported, give this kind of css
So auto/system is in light mode all the time...
Edit 2: the weirdest part is that "sometimes", in dev, the css is the same way as in export/production (I tested with or without output: export). I guess I am missing something about how the CSS is generated.
Does anyone have a clue about what could cause this issue ?
Beta Was this translation helpful? Give feedback.
All reactions