fix(pg-cloudflare): use conditional export to support bundlers that d…#3482
Merged
brianc merged 1 commit intobrianc:masterfrom Jun 12, 2025
CHC383:fix/webpack-bundle
Merged
fix(pg-cloudflare): use conditional export to support bundlers that d…#3482brianc merged 1 commit intobrianc:masterfrom CHC383:fix/webpack-bundle
brianc merged 1 commit intobrianc:masterfrom
CHC383:fix/webpack-bundle
Conversation
…on't know about cloudflare:sockets
Owner
|
This is absolutely, super helpful. Thank you so much 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #3452
Conditional export was chosen as the fix to align with the previous solution #2978, however this does require the consumers to explicitly resolve the condition to
cloudflarein their bundler's config with some extra setup, which might be considered as a breaking change.A private package
pg-bundler-testis also created to test the bundling case. It will be run throughyarn testand testwebpack,vite(usesrollupunderneath),rollupandesbuildto bundle the code that importspg-cloudflare.webpack,viteandrollupare all having problems bundlingcloudflare:socketsif not specifically exclude/ignore it, whileesbuildworks fine. These are the top bundlers on my head, other examples and tests could be added later.I didn't update
docsas I searched forcloudflareon node-postgres.com and didn't find anything, so I am not sure where is the right place. Hopefully the README of pg-cloudflare is good enough, and feel free to add more docs if necessary.Note: Vite 5+ requires Node 18+, so the Vite bundler test is skipped on Node 16, see the
vitescript in thepackage.jsonfor the details.