I see a couple of answers here on error ReferenceError: document is not defined
but none of the solutions work for my particular case. Previously marked as duplicate but isn't the solution and the post is 3 years 9 months out of date and the syntax is much different now for both React and Next and SSR vs Client Rendering.
In the terminal it reads:
- error node_modules/styletron-engine-atomic/dist-node-cjs/client/client.js (167:0) @ new StyletronClient
- error ReferenceError: document is not defined
at eval (./src/app/layout.js:15:16)
at (sc_client)/./src/app/layout.js (/Users/anthonyweston/Sites/fogg/.next/server/app/page.js:2296:1)
at __webpack_require__ (/Users/me/Sites/nextjs-baseweb/.next/server/webpack-runtime.js:33:42)
null
I see some references to next/dynamic mentioned in other questions, but that doesn't seem to be the solution here?
The package is available on GitHub if you want to reproduce.