Open raulfdm opened 9 months ago
Confirmed adding the types to the export sections fixes this. Wondering if we can do a shorter PR in the interim to just add these?
Confirmed adding the types to the export sections fixes this. Wondering if we can do a shorter PR in the interim to just add these?
The package.json of graphql-modules
already declares the exports.type
:
The problem is that the version of the bundler lib doesn't include this feature. Meaning that the only solution would be upgrading it.
I was able to workaround this issue with a quick and dirty solution using patch-package and
diff --git a/node_modules/graphql-modules/package.json b/node_modules/graphql-modules/package.json
index 3feda76..d37c95f 100644
--- a/node_modules/graphql-modules/package.json
+++ b/node_modules/graphql-modules/package.json
@@ -30,7 +30,8 @@
"exports": {
".": {
"require": "./index.js",
- "import": "./index.mjs"
+ "import": "./index.mjs",
+ "types": "./index.d.ts"
},
"./*": {
"require": "./*.js",
same problem here
Any updates on this? This is killing my ci/cd pipeline :/
Describe the bug
I've noticed that when using
graphql-modules
in a TypeScript project that definesmoduleResolution: "bundler"
:TypeScript cannot resolve the type definitions:
That's because in the generated
dist/package.json
, thetypes
field is not present in theexports
condition:I won't write all the details here because I saw you're using a tool called
bob
to generate the final dist, and the problem is there.I just opened this issue to keep it as a reminder so that when this problem is fixed on the
bob
's side, you can upgrade it and generate a release.To Reproduce
Expected behavior
Working without a problem in TS configs where it defines the
moduleResolution
equalsbundler
Environment:
graphql-modules
: 2.3.0Additional context