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

问题描述 投票:0回答:0

更新依赖项然后更改 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"
  },
javascript node.js reactjs npm gatsby
© www.soinside.com 2019 - 2024. All rights reserved.