-
Notifications
You must be signed in to change notification settings - Fork 27
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
cloudflare: importing node:http
wrongly import the unenv stream polyfill
#353
Comments
I am happy to help with this but I would need more info:
I am not sure to understand the problem here.
We don't want to use the stream polyfill as it's builtin workerd.
I changed the relative imports to event in the tentative, are you saying I shouldn't have? |
I think there are multiple topics here, the fact that unenv I understand that workerd runtime also implements Other imports such as Meanwhile cloudflare preset is being extracted it is really hard to tell but I guess in wrangler esbuild plugin, path rewrites can specifically happen also.
Can't we implement it as a quick fix? |
this example is under production use for all nuxt, nitro, and h3 when users call |
So IIUC the only problem is with the import of stream in http.
I'll submit a PR. |
I love to add tests (and if you like to help) as soon as we finish cloudflare preset externalization. There are tests in h3 and nitro that immediately break and it wasn't a concern before because unenv was made for nitro as a polyfill-only lib. |
Is there a dependency here or is it only because this is the logical order of things. I have worked on the testing story today, not there yet but hopefully early next week. |
Having the external preset, we can also properly test the compatibility (and see what needs to go where) Do you know how/when opennextjs/opennextjs-cloudflare#147 had been introduced? Does calling server actions from client components involve using |
No, I'll investigate next week to figure out the root cause. |
Environment
7a9f230
Nodejs 22.11.0
Reproduction
See https://github.com/unjs/unenv/pull/352/files#diff-2f5c73584260f31cbdff9f65cf07fd8f619f8b48ddda9d87e1e99d583ac0f87c
Describe the bug
Without the PR, importing
node:http
also imports the unenv polyfill for stream because it is imported as a relative path.Because the
Readable
polyfill does not implement the async iterator the test would throw[unenv] Readable.asyncIterator is not implemented yet!
.For cloudflare, the builtin stream implementation should be used instead.
Additional context
See the comments in the tentative PR
Logs
No response
The text was updated successfully, but these errors were encountered: