|
"exports": { |
|
".": { |
|
"import": "./esm/index.js", |
|
"require": "./dist/index.js", |
|
"default": "./dist/index.js" |
|
}, |
|
"./dist/*": { |
|
"import": "./dist/*", |
|
"require": "./dist/*", |
|
"default": "./dist/*" |
|
} |
|
}, |
It seems that by adding the new "exports" flags to package.json, now when compiling anything depending on pg (and relatively @types/pg) using the bundler module resolution fails with:
│ /home/runner/work/lib-sqs/lib-sqs/node_modules/@types/pg/index.d.ts
│ 12:31 Cannot find module 'pg-protocol/dist/messages' or its corresponding type declarations. [TS2307]
│ | import { NoticeMessage } from 'pg-protocol/dist/messages';
I think the correct definition for the dist export in package.json should be something like the following:
"exports": {
".": {
"import": "./esm/index.js",
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"default": "./dist/index.js"
},
"./dist/*": {
"types": "./dist/*.d.ts",
"require": "./dist/*.js"
}
}
Nothing in dist seems to be an ESM module (so no "import") and types and extensions should be explicit...
node-postgres/packages/pg-protocol/package.json
Lines 7 to 18 in 9bfc967
It seems that by adding the new "exports" flags to
package.json, now when compiling anything depending onpg(and relatively@types/pg) using thebundlermodule resolution fails with:I think the correct definition for the
distexport inpackage.jsonshould be something like the following:Nothing in
distseems to be an ESM module (so no "import") andtypesand extensions should be explicit...