css - Gatsby v2网站无法正确加载CSS

标签 css build gatsby

在我的开发环境中,该站点看起来像预期的那样,但是当我运行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":{}}

我认为该对象为空是我的问题。我曾尝试禁用服务人员,但这只会使问题变得更糟。

我也尝试过
  • 强制构建并禁用netlify上的缓存
  • 删除npm和package.json文件,然后运行npm build

  • 但到目前为止没有运气。

    最佳答案

    我有同样的问题。就我而言,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/

    相关文章:

    java - 如何使用 Maven 创建具有依赖项的可执行/可运行 JAR?

    objective-c - Objective-C 链接器错误 : Undefined Symbols

    javascript - Gatsby : Display 404 page if route doesn't exist

    javascript - 是否可以在加载内容时将加载程序图像放入 iframe 中?

    防止引用禁止类的 Java 构建过程

    html - CSS:具有可滚动中心的 4 行流体?

    javascript - 来自 dangerouslySetInnerHTML 的完全相同的代码不能仅在 Gatsby/ReactJS 页面内工作

    javascript - 构造和检索具有多种尺寸的 JSON 对象(图像)

    html - css:更简单的写法:div.markup h1,div.markup h2,div.markup h3{color:#f00;}?

    CSS - 等高列?