Using math.random() in css module leads to a wrongly generated class names
#4238
Replies: 1 comment
|
This sounds like a problem with |
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.
I used
create-preactto initialise my app.It uses
vite v4.3.2andsass v1.69.5.I have a scss module with a code that contains
math.random().And because of the
math.random()as a result the names that are assigned to the html elements are not that are being generated and loaded in the stylesheet.With the

math.random()Without the

math.random()For clarity. When the
math.random()is used the generated class name that is used forclass=""has1lzbopart in the class name, but in the injected <style> tag it'syl1g2. When themath.random()is not used, the class names are correct. Both have1u0g5in their name.The css property name that is using
math.random()does not matter. The behaviour is consistent per file which containsmath.random()whilenpm run dev.I tried reproducing it, but no success. The minimal version works correctly.
https://stackblitz.com/edit/vitejs-vite-dtieff?file=style.module.scss
Haven't yet tried upgrading
viteto the latest version.What could be wrong? Which part could be failing here? And how can I try to fix this? Apart from not using
math.random().All reactions