Replies: 2 comments
-
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.
0 replies
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 export
for 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