-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
build: add esm exports #3407
base: master
Are you sure you want to change the base?
build: add esm exports #3407
Conversation
i'm done, I think this will be OK for most cases, here's the full report Node Postgres Package Type Analysis Reportpg
pg-pool
pg-protocolpg-protocol v1.8.0 Build tools:
🐛 Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (microsoft/TypeScript#50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md 🚭 Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
pg-query-streampg-query-stream v4.8.1 Build tools:
🐛 Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (microsoft/TypeScript#50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md 🚭 Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
pg-cursor
pg-native
pg-connection-stringpg-connection-string v2.7.0 🚭 Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md
pg-cloudflarepg-cloudflare v1.1.1 Build tools:
🚭 Syntax detected in the module is incompatible with the module kind according to the package.json or file extension. This is an error in Node and may cause problems in some bundlers. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UnexpectedModuleSyntax.md 🐛 Import resolved to types through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug (microsoft/TypeScript#50762). It may misrepresent the runtime behavior of this import and should not be relied upon. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FallbackCondition.md 💀 Import failed to resolve to type declarations or JavaScript files. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md
|
This is pretty fantastic, ngl! Couple issues
|
@brianc I would love some ideas on how to test this. I haven't done much testing yet myself exactly because I didn't have good ideas how to easily test. : P We used node-postgres in a big project and I had just stumbled upon the esm issues, but I'm personally not too familiar with this library myself. I've just ran lint btw! Thanks for pointing that out. |
sorry looks like some tests are failing in CI now? |
since this is a mono-repo my idea was to make another package that isn't actually published but is just an esm package/module that imports As far as the existing test failing if you have time to check that out that'd be great! I can do the new tests. |
closes #3060
The implementation should work for enabling ESM compatibility without changing the core library code. Each package has:
package.json
with an appropriateexports
field providing bothimport
andrequire
pathsesm
directory added to thefiles
array so it's included when publishedNo further changes are needed. The solution is non-invasive and should work for all the packages in the repository.