Skip to content

Replace cloudflare export condition in pg-cloudflare with workerd #3498

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

Merged
merged 2 commits into from
Jun 26, 2025

Conversation

jamesopstad
Copy link
Contributor

@jamesopstad jamesopstad commented Jun 26, 2025

Fixes #3493
Fixes cloudflare/workers-sdk#9668

This changes the export conditions for pg-cloudflare to use workerd instead of cloudflare. workerd is the standard export condition for Cloudflare Workers, as specified by WinterCG - https://runtime-keys.proposal.wintercg.org/#workerd. This will ensure compatibility with Wrangler and the Cloudflare Vite plugin.

Comment on lines +14 to 17
"workerd": {
"import": "./esm/index.mjs",
"require": "./dist/index.js"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep both for backward compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the cloudflare condition was only added very recently and seems broken for most people using it, I would be in favour of removing it. We don't want to encourage others to use this as an export condition for Cloudflare Workers.

Copy link

@thomasgauvin thomasgauvin Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what we can tell, this was merged in #3482 by @brianc, but in so doing inadvertently broke the majority of Cloudflare projects given that workerd is the export condition expected

@brianc
Copy link
Owner

brianc commented Jun 26, 2025

aye! sorry for breaking this - trying to migrate to esm while also maintaining commonjs compat has been an absolute nightmare, surprisingly! I'll get this pushed up ASAP! ❤️

@brianc brianc merged commit 54964ec into brianc:master Jun 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pg-cloudflare does not work with vite-plugin-cloudflare CloudflareSocket is not a constructor in [email protected]
4 participants