Closed johnnyomair closed 3 years ago
Your @nestjs/{...}
deps must be defined as peer dependencies. Otherwise, both your lib and application will have a dedicated, local copy of these packages in the node_modules
folder (lib/node_modules/@nestjs/graphql/{random-class}
!== test/node_modules/@nestjs/graphql/{random-class}
).
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
I can add to this that if anyone runs into an issue when using npm link having a service for example using a package with @nestjs/graphql which in turns uses another package having @nestjs/graphql. The answer above won't solve it for running locally. This is an issue with how npm link works and I suggest to try yalc instead.
Link references the entire source code with node_modules which basically makes the package used by this package to reference @nestjs/graphql there instead of the service causing the same issue as stated above. Yalc works differently and does not cause this issue.
I'm submitting a...
Current behavior
When using GraphQL scalars (e.g.
ID
) in resolvers placed inside a library (therefore imported from node_modules/), Nest fails to determine the output type:Using a
String
works perfectly fine.Expected behavior
Nest correctly determines the output type.
Minimal reproduction of the problem with instructions
https://github.com/johnnyomair/nestjs-graphql-scalar-demo
Steps
cd lib/ && npm install && npm run build
cd test/ && npm install && npm start:dev
What is the motivation / use case for changing the behavior?
I can't use GraphQL scalars (
ID
,Int
andFloat
) in my library package.Environment
Others:
Might be related to: https://github.com/nestjs/graphql/issues/781