Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document is not defined #823

Closed
joanned opened this issue Dec 22, 2022 · 1 comment
Closed

Document is not defined #823

joanned opened this issue Dec 22, 2022 · 1 comment

Comments

@joanned
Copy link

joanned commented Dec 22, 2022

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 #793
After I upgraded to nextjs 12 from 11, I'm getting a ton of these errors:

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
  • OS: Mac

Did this work in previous versions?

yes, next 11.0.0

@joanned
Copy link
Author

joanned commented Dec 22, 2022

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.

@joanned joanned closed this as completed Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant