最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Next.js "document is not defined". Document is not being referenced anywhere however - Stack Overflow

programmeradmin0浏览0评论

I am trying to export my next application as a static webpage. There is ZERO SSR in this app. There should not be any attempts at implementing SSR at all. It is STRICTLY a static webpage. It gives me an error it cannot prerender '/' as 'document is not defined'. There is no code in the homepage that even remotely closely references the document. There are also no third party libraries being referenced. Obviously, since there is no relevant code, there's nothing for me to actually show. Why on earth would this tell me that 'document is not defined' if document is not being referenced? Is there a way to get more verbose output than npm run build? This is a blocker for moving us into production as we cannot get our frontend past CI/CD.

The next config marks the export as output only. This should not be locking me to SSR, so I don't even know why it's checking for this, as document WILL be defined on runtime, so this is a useless check. Even if we were referencing document somewhere, the code would work fine. Is there a way to turn this check off?

发布评论

评论列表(0)

  1. 暂无评论