Skip to content

pg-connection-string v2.8.0 broke default export #3424

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

Closed
hjr3 opened this issue Apr 22, 2025 · 5 comments · Fixed by #3425
Closed

pg-connection-string v2.8.0 broke default export #3424

hjr3 opened this issue Apr 22, 2025 · 5 comments · Fixed by #3425

Comments

@hjr3
Copy link
Collaborator

hjr3 commented Apr 22, 2025

@hjr3 just a heads up, 2.8.0 was technically a breaking change. Even though module.exports = parse still existed, it broke the default export:

import pgConnectionString from 'pg-connection-string';
       ^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'pg-connection-string' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.14.0

I'm guessing it's an ESM / bundler or whatever type error, but it's easy enough to fix and switch to import { parse } from 'pg-connection-string';

Originally posted by @ThisIsMissEm in #3421

@hjr3
Copy link
Collaborator Author

hjr3 commented Apr 22, 2025

looking at [email protected]@2.8.0 i wonder if 940479b caused an issue

hjr3 added a commit that referenced this issue Apr 22, 2025
Prior to v2.8.0, the parse function was the default when using import.
When esm compatibility was introduced in v2.8.0, there was not default
specified. This broke existing code that relied on that default.

Fixes #3424
@cdco-paul-legrand
Copy link

+1, had the same issue this morning

@brianc
Copy link
Owner

brianc commented Apr 22, 2025

+1, had the same issue this morning

so sorry! Publishing a fix right now

@cdco-paul-legrand
Copy link

@brianc thanks for such a quick fix 🙌🙌 that was awesome! I hadn't expected to hear back, much less so soon

@brianc
Copy link
Owner

brianc commented Apr 22, 2025

❤ thanks for letting me know! I always try to do a release in the morning so I can be extra vigilant on monitoring my github issues for the first day just incase something like this happens! I've been on the receiving end of unintended (and also semver major) breaking changes enough to know the pain, and I want to reduce that pain for as many folks as possible.

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 a pull request may close this issue.

3 participants