Gatsby 站点在依赖项更新后不呈现

编程入门 行业动态 更新时间:2024-10-06 04:05:12

Gatsby <a href=https://www.elefans.com/category/jswz/34/1771026.html style=站点在依赖项更新后不呈现"/>

Gatsby 站点在依赖项更新后不呈现

更新依赖项然后更改 css 导入后,当我在本地运行

gatsby develop
时出现空白页面。

一直运行良好,直到:

  1. 我更新了所有的依赖项
  2. 更新后,CSS模块出现错误。以前,组件导入样式如下:
import styles from "./ExampleComponent.module.css"

function ExampleComponent() {
  return (
    <h2 className={styles.example}>This is an example</h2>
  )
}

为了修复错误,我将其更改为:

import "./ExampleComponent.module.css"

function ExampleComponent() {
  return (
    <h2 className="example">This is an example</h2>
  )
}

现在,当我尝试在本地运行网站时,它只显示一个空白页面。没有控制台或网络错误,所以我不知道出了什么问题?

这些是更新的依赖项:

"dependencies": {
    "dotenv": "^16.0.3",
    "formik": "^2.2.9",
    "gatsby": "^5.9.0",
    "gatsby-image": "^3.11.0",
    "gatsby-plugin-catch-links": "^5.9.0",
    "gatsby-plugin-google-analytics": "^5.9.0",
    "gatsby-plugin-image": "^3.9.0",
    "gatsby-plugin-manifest": "^5.9.0",
    "gatsby-plugin-offline": "^6.9.0",
    "gatsby-plugin-react-helmet": "^6.9.0",
    "gatsby-plugin-sharp": "^5.9.0",
    "gatsby-plugin-typography": "^5.9.0",
    "gatsby-remark-copy-linked-files": "^6.9.0",
    "gatsby-source-filesystem": "^5.9.0",
    "gatsby-transformer-excel": "^5.9.0",
    "gatsby-transformer-remark": "^6.9.0",
    "gatsby-transformer-sharp": "^5.9.0",
    "imagemin-pngquant": "^9.0.2",
    "install": "^0.13.0",
    "node": "^19.8.1",
    "npm": "^9.6.5",
    "pngquant-bin": "^8.0.1",
    "primereact": "^9.3.1",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-headroom": "^3.2.1",
    "react-helmet": "^6.1.0",
    "react-icons": "^4.8.0",
    "react-typography": "^0.16.23",
    "rebass": "^4.0.7",
    "typeface-roboto": "^1.1.13",
    "typography": "^0.16.21"
  },
回答如下:

更多推荐

Gatsby 站点在依赖项更新后不呈现

本文发布于:2024-05-30 15:17:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1770633.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:站点   Gatsby

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!