Gatsby 5+ 和 gatsby-plugin-preact 错误“renderToPipeableStream 不是函数”

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

我有 Gastby 5.13.2,并且我已经安装了

gatsby-plugin-preact
以及
preact
react-render-to-string
。当我尝试
npm run build
时,我收到此错误:

WebpackError: TypeError: renderToPipeableStream is not a function

我的

package.json
看起来像这样:

  "dependencies": {
    "@rmwc/menu": "^14.0.7",
    "@rmwc/tabs": "^14.0.7",
    "classnames": "2.5.1",
    "common": "file:../common/",
    "dotenv": "8.2.0",
    "echarts": "^5.4.3",
    "echarts-for-react": "^3.0.2",
    "gatsby": "^5.13.2",
    "gatsby-plugin-env-variables": "^2.3.0",
    "gatsby-plugin-google-tagmanager": "^5.13.1",
    "gatsby-plugin-image": "^3.13.1",
    "gatsby-plugin-manifest": "^5.13.1",
    "gatsby-plugin-optimize-svgs": "^1.0.5",
    "gatsby-plugin-preact": "^7.13.1",
    "gatsby-plugin-react-helmet": "^6.13.1",
    "gatsby-plugin-react-helmet-canonical-urls": "^1.4.0",
    "gatsby-plugin-react-svg": "^3.3.0",
    "gatsby-plugin-recaptcha": "^1.0.5",
    "gatsby-plugin-remove-trailing-slashes": "^4.19.0",
    "gatsby-plugin-robots-txt": "^1.8.0",
    "gatsby-plugin-s3": "^0.4.1",
    "gatsby-plugin-sass": "^6.13.1",
    "gatsby-plugin-sharp": "^5.13.1",
    "gatsby-plugin-sitemap": "^6.11.0",
    "gatsby-plugin-split-css": "^2.0.3",
    "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.32",
    "gatsby-source-drupal": "^6.13.1",
    "gatsby-source-filesystem": "^5.13.1",
    "gatsby-transformer-sharp": "^5.13.1",
    "parse-entities": "4.0.1",
    "preact": "^10.19.6",
    "preact-render-to-string": "^5.2.6",
    "react": "^18.2.0",
    "react-compare-slider": "3.0.1",
    "react-dom": "^18.2.0",
    "react-helmet": "6.1.0",
    "react-html-parser": "2.0.2",
    "react-infinite-scroller": "1.2.6",
    "react-modal": "3.16.1",
    "react-player": "^2.14.1",
    "react-scroll": "1.9.0",
    "react-share": "5.0.3",
    "react-zoom-pan-pinch": "^3.3.0",
    "sass": "^1.70.0",
    "swiper": "6.5.4",
    "typed.js": "^2.1.0",
    "universal-cookie": "4.0.4",
    "uuid": "^9.0.1"
  },
  "devDependencies": {
    "@testing-library/jest-dom": "^6.3.0",
    "@types/jest": "^29.5.11",
    "@types/node": "^20.11.7",
    "@types/react": "^18.2.48",
    "@types/react-dom": "^18.2.18",
    "@types/react-helmet": "^6.1.11",
    "@types/react-html-parser": "2.0.6",
    "@types/react-infinite-scroller": "1.2.5",
    "@types/react-scroll": "1.8.10",
    "@types/uuid": "^9.0.8",
    "gatsby-plugin-typescript-checker": "1.1.1",
    "jest": "^29.7.0",
    "tsc-files": "^1.1.4",
    "typescript": "5.3.3"
  }

使用 React 一切正常。

reactjs gatsby preact
1个回答
0
投票

preact-render-to-string
不支持
renderToPipeableStream

您需要切换到不需要它的 Gatsby 版本,修补 Gatsby 的实现,或切换到 React。

© www.soinside.com 2019 - 2024. All rights reserved.