Open terao-ryohei opened 2 years ago
Is there any update on this issue? Same problem here. This error pops when you use "globalCSS" or "keyframes" in Vite.
"@stitches/react": "1.2.8", "vite": "^3.0.9",
Is there any update on this issue? Same problem here. This error pops when you use "globalCSS" or "keyframes" in Vite.
"@stitches/react": "1.2.8", "vite": "^3.0.9",
Hello, may I ask how can I implement global styles in my Vite React app? This is my main.tsx
https://hastebin.com/xuyujatawi.js
Is there any update on this issue? Same problem here. This error pops when you use "globalCSS" or "keyframes" in Vite.
"@stitches/react": "1.2.8", "vite": "^3.0.9",
Hello, may I ask how can I implement global styles in my Vite React app? This is my
main.tsx
https://hastebin.com/xuyujatawi.js
You can find it here: https://stitches.dev/docs/styling
Hello, I just had the problem. I hope that message will help someone. From my side, the problem comes from my Vite configuration (vite.config.js) which redefines "global"
define: {
// ...
global: {},
},
This configuration overwrites the names of the rules in Stitches:
(Stitches: sheet.js)
/**
* Rules in the sheet appear in this order:
* 1. theme rules (themed)
* 2. global rules (global)
* 3. component rules (styled)
* 4. non-responsive variants rules (onevar)
* 5. responsive variants rules (resonevar)
* 6. compound variants rules (allvar)
* 7. inline rules (inline)
*/
/** @type {RuleGroupNames} */
export const names = ['themed', 'global', 'styled', 'onevar', 'resonevar', 'allvar', 'inline']
Which is broken after the build:
["themed", "{}", "styled", "onevar", "resonevar", "allvar", "inline"]
Finally, the "rules" object inside Stitches looks like that :
rules : {
"themed" : {...}
"{}": {...}
// etc.
}
That's why you have a null pointer when globalCss access rules.global.cache.
Bug report
If I build react project, I got err.
code:
err:
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Screenshots
If applicable, add screenshots to help explain your problem.
System information
OS: [macOS]
Browser (if applies) [chrome]
Version of Stitches: [1.2.8]
Version of Node.js: [16.14.2]
react [18.1.0]
vite [2.9.8]
typescript [4.6.4]