盖茨比错误#95313中的生成错误
为path“/components/设置/”构建静态HTML失败
生成时出现错误的组件是
export const sc = () => {
if (typeof window == "undefined") return {}
else
return {
lgScr: window.innerHeight >= 901,
smScr: window.innerHeight >= 635 && window.innerHeight < 900,
mobile: window.innerWidth < 600,
}
}错误日志
错误
Page data from page-data.json for the failed page "/components/settings/": {
"componentChunkName": "component---src-pages-components-settings-js",
"path": "/components/settings/",
"result": {
"pageContext": {}
},
"staticQueryHashes": []
}为页面构建静态HTML失败-0.592 s
错误#95313
为path“/components/设置/”构建静态HTML失败
有关此错误的更多信息,请参见文档页:https://gatsby.dev/debug-html
WebpackError:小型化反应错误#130;访问https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]=获取完整消息,或使用非小型化开发环境nt获取全部错误和其他有用的警告。
gatsby-starter-hello-world/@gatsbyjs/reach-router/es/lib/utils.js:22:1
发布于 2021-07-22 16:23:57
如果它是一个应该大写的组件(Sc),那么如果它是一个独立的函数,它可以被称为sc。此外,尝试恢复条件。您只希望在定义了window数据(与undefined不同,else条件不同)时才使用它:
export const Sc = () => {
if (typeof window !== "undefined") {
return {
lgScr: window.innerHeight >= 901,
smScr: window.innerHeight >= 635 && window.innerHeight < 900,
mobile: window.innerWidth < 600,
}
}
else return {}
}https://stackoverflow.com/questions/68487398
复制相似问题