Skip to content

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

Merged
brianc merged 2 commits intobrianc:masterfrom
brenoepics:fix-exports
Apr 23, 2025
Merged

fix(exports): resolve issues with module imports and requires#3428
brianc merged 2 commits intobrianc:masterfrom
brenoepics:fix-exports

Conversation

@brenoepics
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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