在我的开发环境中,该站点看起来像预期的那样,但是当我运行gatsby build时,我的CSS无法正确显示。如果我手动导航到另一个页面,那么CSS将按预期显示。
没有错误,但我确实收到此警告:
The resource http://localhost:9000/static/d/520/path---offline-plugin-app-shell-fallback-a-30-c5a-NZuapzHg3X9TaN1iIixfv1W23E.json was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate
as
value and it is preloaded intentionally.
当我检查该文件时,它显示:
{"pageContext":{}}
我认为该对象为空是我的问题。我曾尝试禁用服务人员,但这只会使问题变得更糟。
我也尝试过
但到目前为止没有运气。
最佳答案
我有同样的问题。就我而言,gatsby-plugin-styled-components
中缺少gatsby-config.js
。
https://www.gatsbyjs.org/packages/gatsby-plugin-styled-components/
https://github.com/gatsbyjs/gatsby/issues/8984
关于css - Gatsby v2网站无法正确加载CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52613354/