fix: use pg-protocol CommonJS entrypoint - #3749
Draft
zfaustk wants to merge 1 commit into
Draft
Conversation
Collaborator
|
This seems like a build misconfiguration, not a pg issue that should be fixed by changing the imports in this way. |
zfaustk
marked this pull request as draft
August 13, 2026 04:48
Contributor
Author
|
Thanks — agreed. The reproduction showed the worker build selecting the ESM |
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.
Fixes #3700.
Problem
When the Cloudflare Vitest/Vite worker pipeline inlines both
pgandpg-protocol, the CommonJSpgentry can resolve the barepg-protocolimport through its ESM condition. Loading that ESM wrapper frompg's CommonJS files then fails before any tests run:I reproduced this with the standalone fixture from #3700 using released
pg@8.23.0,pg-protocol@1.16.0,@cloudflare/vitest-pool-workers@0.16.18, and Vitest 4.1.9.Fix
pg-protocol/dist/index.jsexplicitly frompg's two CommonJS entry files;This remains package-manager independent:
pg-protocolexposes./dist/*.jsthrough its publicexportsmap, andpgcurrently depends onpg-protocol ^1.16.0.Tests
make test-unitfrompackages/pg;yarn lint;yarn build;git diff --check.The full PostgreSQL/Node matrix was not run locally; it is left to CI. The repository's existing Cloudflare integration test also gets past module collection with the worker inline settings after the patch, then stops at this executor's unavailable PostgreSQL endpoint.
Implementation and test preparation were assisted by Codex. The reproduction and all reported checks above were run against this branch.