-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build failed after using react v18+ and gatsby-plugin-preact #35500
Comments
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
It seems to be caused by the condition of checking whether React 17 or 18 is used. It seems to work something like this
Now because you don't need to install React when using Preact, the condition check fails and Gatsby uses React 18 API regardless. A workaround is to install React 17, despite you are not using it. |
The Gatsby check uses webpack global defined here. Not sure why preact is making that falsy? |
@mwskwong Many users would believe upgrading the packages in In the meantime there are two options
|
This comment was marked as duplicate.
This comment was marked as duplicate.
FWIW, I don't think Preact is really close to compat with React 18 at this point: preactjs/preact#2621 (comment) |
@graysonhicks Thanks for the info. I guess it would still be great to keep this issue open and let people know what is the root cause of this |
This was my issue reverted to React 17 and fixed the issue |
Reverted to react 17 as react 18 is still not compat with preact. Ref: gatsbyjs/gatsby#35500
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
This issue is not solved. I still find the problem on the latest release. |
I think the issue is still upstream with Preact not support React 18. |
@graysonhicks Thanks for this I understand Gatsby is not the root cause but I personally still think this issue should keep open as it would be benefitial for everyone who use preact to know that they need to pick react version 17 or they would get error |
@winstonma I understand that reasoning however with Gatsby 5 coming up which requires React 18 I don't see a path forward for this other than the upstream issue being fixed. I'm afraid we have to close this then once Gatsby 5 is out. |
@LekoArts Thanks for the information. Does it mean that the it is very likely that Just wonder if it is possible that the |
It seems like that, yes.
|
@LekoArts Thanks for answering Yeah I guess it would be more right if Hmm... |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Just trying to re-open this issue after upgrading to the latest version of Gatsby, React, & Node. The latest version of Gatsby requires React 18 (https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v4-to-v5/#minimal-required-react-version-is-18). Because of this, when installing gatsby-plugin-preact, preact, and preact-render-to-string (https://www.gatsbyjs.com/plugins/gatsby-plugin-preact/) it breaks my build with the following error:
WebpackError: TypeError: renderToPipeableStream is not a function` Is this a known issue or is there a current workaround so that Preact can still be used? |
@juliannehalversen Please check #35500 (comment). If preact don't support (well) with react 18+, this path would not work. As Gatsby 5 requires react 18, thus preact would not work with Gatsby 5. |
@winstonma Thanks for the reply. Sounds like if there's no current fix then Gatsby should update their docs for that plugin so people know it's incompatible when upgrading. |
Hmm this part is a bit tricky as the root cause of this plugin not working is neither Gatsby nor gatsby-plugin-preact, is preact. I also asked if it is possible to add dependency stuff so the gatsby-plugin-preact installation fail if react 18 is being used. But the team thinks it is preact's not Gatsby or gatsby-plugin-preact problem (#35500 (comment)). |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
I just have updated one project to Gatsby v5. This project is using the preact-plugin. Indeed it's not working during the build process. By disabling gatsby-plugin-preact, it's working but loosing some points on Lighthouse metrics… |
I have the same issue. Brought my lighthouse score down by 25 points. I'm delaying migrating to Gatsby v5 because of this performance hit. |
@eur2 @juliannehalversen Unfortunately this issue is upstream, with Preact, not with Gatsby. The required PR is here: preactjs/preact-render-to-string#259 You can watch that PR for updates, but it is out of our hands. (Note that this same Preact issue is blocking users of Remix and Next.js 13). |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
I still have the same error! Does anyone have any idea how I can get Gatsby and Preact running together? These are my configurations: |
Are there any intentions on fixing this? It's been over 2 years since the issue was reported but no solution was provided yet. I've seen some suggestions but no actions taken. |
I am facing the same issue when I tried to upgrade our Gatsby 4 project to Gatsby 5, we only Netlify to build and host. I was able to get it work in my local environment, gatsby develop/build had no problem, when just when I shipped to Netlify, everytime I will get WebpackError: TypeError: renderToPipeableStream is not a function, this issue seems to be fixed recently but not sure why it persists, is it sort of upstream issue on preact or gatsby-plugin-react side? we are close to up to date regarding preact, preact-to-string, and gatsby-plugin-preact. This is really blocking us atm, and disabling preact may not be a quick and feasible. Not sure if anyone uses Netlify has similar issues |
Preliminary Checks
Description
As titled
Reproduction Link
https://github.com/gatsbyjs/gatsby-starter-blog.git
Steps to Reproduce
Then edit
gatsby-config.js
, following the gatsby-plugin-preact How to use guildThe build would be success
2. The build fail after updating react to v18+
Expected Result
Build success
Actual Result
Got
WebpackError: TypeError: renderToPipeableStream is not a function
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: