#1054·stitches

When using "globalStyles", I had err "Cannot read properties of undefined (reading 'cache')" in build.

Author: terao-ryoheiCreated Jul 5, 2022Updated May 17, 2023

Bug report

If I build react project, I got err.

code:

typescript
import { globalStyles } from './styles/globalStyles';

export function App() {
  globalStyles();
  return (
    <BrowserRouter>
      <Router />
    </BrowserRouter>
  );
}
typescript
import { globalCss } from './stitches.config';

// Initialize Global Styles
export const globalStyles = globalCss({
  body: {
    backgroundColor: '#80B2D2',
    fontWeight: '500',
    color: '#666',
    fontFamily: 'M PLUS Rounded 1c',
  },
});

err:

TypeError: Cannot read properties of undefined (reading 'cache')
    at r (index.96b2b110.js:210:16102)
    at xje (index.96b2b110.js:291:64430)
    at jC (index.96b2b110.js:186:19132)
    at mF (index.96b2b110.js:188:44699)
    at hF (index.96b2b110.js:188:40312)
    at Rfe (index.96b2b110.js:188:40238)
    at Im (index.96b2b110.js:188:40089)
    at Cx (index.96b2b110.js:188:36423)
    at cF (index.96b2b110.js:188:35367)
    at E (index.96b2b110.js:173:1628)

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Use "globalStyles" in code.
  2. Build and serve

Screenshots

If applicable, add screenshots to help explain your problem.

スクリーンショット 2022-07-05 15 21 12

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]