ReferenceError: document is not defined
at new StyleSheet (.../node_modules/styled-jsx/dist/index/index.js:40:53)
at new StyleSheetRegistry (.../node_modules/styled-jsx/dist/index/index.js:306:37)
at Object.createStyleRegistry (.../node_modules/styled-jsx/dist/index/index.js:445:12)
at renderToHTML (.../node_modules/next/server/render.tsx:604:49)
at ...node_modules/next/export/worker.ts:473:26
at Span.traceAsyncFn (.../node_modules/next/trace/trace.ts:106:14)
If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar
It's an entire repo with an upgrade from nextjs 11 to 12 so I'm not sure you can repro this.
What is the expected behavior?
No errors
Environment (include versions)
Version of styled-jsx (or next.js if it's being used): 12.3.4 (next)
Browser: none. this error is happening during build
for some reason, importing the library universal-tilt-js into one of our files caused this document not defined error in all our nextjs pages. after much trial and error, removing this library solved the issue.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
I'm having the exact same issue as https://github.com/vercel/styled-jsx/issues/793 After I upgraded to nextjs 12 from 11, I'm getting a ton of these errors:
If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar
It's an entire repo with an upgrade from nextjs 11 to 12 so I'm not sure you can repro this.
What is the expected behavior?
No errors
Environment (include versions)
Did this work in previous versions?
yes, next 11.0.0