-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
TypeError: ReactDOMServer.renderToReadableStream is not a function #4608
Comments
10.24.0 hasn't changed anything relating to exports https://github.com/preactjs/preact/releases/tag/10.24.0. We've also never had that export so maybe something else got upgraded? |
I thought it might've been the case, but giscus/giscus#1576 shows that it is preact 10.24.0 (only) that caused the build to fail 😔 All the other packages (except Next.js ones) updated without issue giscus/giscus#1574. |
That's very odd, we've never had that export in https://github.com/preactjs/preact/blob/main/compat/server.mjs#L11-L15 - kind of confused how that's possible, maybe because we updated the fake compat version Next thinks it can start leveraging the stream #4488 |
Indeed, Next sniffs out the React version and alters behavior (rather considerably) for 18.0+. Any reason to avoid re-exporting it? Next may or may not work well with it of course, but that's a separate issue. |
I am personally not confident in our streaming implementation atm as it's not battle tested so our issue counter might explode if we do 😅 |
Well, faking compat version might've fixed that other issue, but it's the culprit for this one. IMO it should be reverted, because updating Preact to a newer minor version should not be a breaking change, when all else is equal. #4441 is a peer dep thing that can probably be silenced on the user's end (?). Anyway, we "solved" this issue by monkeypatching sed -i -E "s|(const shouldUseReactRoot) = .+?;|\1 = false;|" ./node_modules/next/dist/server/utils.js I recall performing a similar hack before preactjs/compat-alias-package#6 landed; in both cases NextJS' |
Unfortunately we can't do much about external packages that use version to determine feature availability, that's outside our control & what semver is meant to protect. I'd be in favor of making |
Yes, let's make the readableStream export available. That being said, next in general isn't officially supported as they made it pretty clear they don't want to collaborate on supporting preact. We supported next for a long time and did our very best to keep up with the changes but it's impossible as they dug through bundler internals a lot. From that point of view I would not consider this a breaking change as it's a hack (stubbing the version) observed by another hack. |
Describe the bug
Hi! I'm trying to update https://github.com/giscus/giscus to the latest Preact version (10.25.2) and I got a
TypeError: ReactDOMServer.renderToReadableStream is not a function
when I try to load any page. Not sure how helpful it is, but here's the stack trace:Stack trace
To Reproduce
Honestly, it's probably my fault for still using Next.js that no longer supports Preact. I'm on Next.js 12.3.4 and next-plugin-preact 3.0.7, as those are the last versions that still work together.
I should probably either move on from Next.js or Preact, but I thought this could possibly a legit bug in Preact, so I'm raising this anyway. Feel free to close this if whatever caused this was intended.
For the record, this still worked fine in 10.23.2. Trying the versions between that and the latest 10.25.2, I found that it started to break in 10.24.0. I couldn't find anything in the release notes that could be related. The closest is probably #4490, but I'm not sure why a warning would cause it to crash.
Expected behavior
I expect it to work just fine, like in 10.23.2.
The text was updated successfully, but these errors were encountered: