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
To summarise, Stylex needs the styles to be written at the top-level, not in the body of a function. Astro compiles the frontmatter into a body of a function.
Astro has an undocumented escape hatch, however: you can write an exported const declaration instead of a const declaration. For example,
This will make astro compile the stylex.create() line onto the top-level or "root" of the module, instead of compiling it into the body of the function.
Hi, it's not possible to use stylex in astro files. I can only use it in react components.
This is the error I get:
stylex.create() is only allowed at the root of a program.
The text was updated successfully, but these errors were encountered: