Skip to content

fix(exports): resolve issues with module imports and requires #3428

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
Apr 23, 2025

Conversation

brenoepics
Copy link
Contributor

@brenoepics brenoepics commented Apr 23, 2025

This PR addresses a regression introduced in pg@8.15.1 due to the addition of ESM support via #3423. The updated exports field in package.json restricts access to internal modules such as lib/connection-parameters.js, which are utilized by tools like node-pg-migrate

As a result, users such as salsita/node-pg-migrate#1398, #3429, #3431, possibly #3430 (couldn't replicate) encounter the following or similar errors:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/connection-parameters.js' is not defined by "exports" in [path-to-repo]/node_modules/pg/package.json

To resolve this, I've updated the exports field to include ./lib/*, ensuring compatibility with existing tools that rely on them.

@brianc
Copy link
Owner

brianc commented Apr 23, 2025

doh! First of all, thanks for the quick work here. Secondly....dang I feel bad sending a breaking change! That was pretty unexpected...I'll get this released asap.

@brianc brianc merged commit 2da196c into brianc:master Apr 23, 2025
6 checks passed
brianc added a commit that referenced this pull request Apr 23, 2025
brianc added a commit that referenced this pull request Apr 23, 2025
@mrickard
Copy link

mrickard commented Apr 23, 2025

@brianc New Relic Node Agent team here. Thanks for getting this merged! We're still seeing errors, though. pg-native loads a file at ./lib/build-result, though the lib directory isn't present in pg-native.

@brianc
Copy link
Owner

brianc commented Apr 23, 2025

New Relic Node Agent team here. Thanks for getting this merged! We're still seeing errors, though. pg-native loads a file at ./lib/build-result, though the lib directory isn't present in pg-native.

ohhhh okay i see it now. OMG Sorry there's so much breakage. I'll add those now w/ some tests.

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.

3 participants