Describe the bug
Dependency resolution doesn't seem to work correctly when using yarn workspaces:
Found 1 error
脳 generated/graphql.ts
Unable to load template plugin matching 'typescript-resolvers'.
Reason:
Cannot find module '@graphql-codegen/core'
Error: Unable to load template plugin matching typescript-resolvers
To Reproduce
Steps to reproduce the behavior:
yarn generate in packages/graphqlhttps://github.com/s-h-a-d-o-w/repro-codegen-workspaces
Expected behavior
Can run the script without errors.
Additional context
It does work when adding this to package.json:
"workspaces": {
"nohoist": [
"@graphql-codegen/**"
]
},
Which is why I would recommend that if a solution can't be found to document this here.
We had an issue with the dependencies mapping (one of the common packages was using core, it caused Yarn to install some of the deps twice). Thanks to @kamilkisiela, we found it.
I fixed it in: https://github.com/dotansimha/graphql-code-generator/pull/3386
Update: there is another issue related to graphql-toolkit, we are working on a fix (https://github.com/dotansimha/graphql-code-generator/pull/3392).
@s-h-a-d-o-w Can you please try 1.11.3-alpha-48bfb197.95? It should work (make sure to use it without ~ or ^).
Also, change the package name in your reproduction to graphql-test or something, because it conflicts with the original graphql.
I tested it now and it seems to work.
Updated the repo - looks good to me too, thanks! 馃槂馃憤
Fixed in v1.12.0
Most helpful comment
@s-h-a-d-o-w Can you please try
1.11.3-alpha-48bfb197.95? It should work (make sure to use it without~or^).Also, change the package name in your reproduction to
graphql-testor something, because it conflicts with the originalgraphql.I tested it now and it seems to work.