graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

graphql-mesh doesn't work nicely with pnpm

Open nezdemkovski opened this issue 3 years ago • 1 comments
trafficstars

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

Graphql Mesh doesn't work nicely with pnpm. Mesh peer dependencies don't get hoisted or symlinked right probably.

 ERROR in ./libs/mesh/src/.mesh/index.ts 10:52-94
       Module not found: Error: Can't resolve '@graphql-mesh/cache-localforage' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/index.ts 11:16-45
       Module not found: Error: Can't resolve '@whatwg-node/fetch' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/index.ts 18:51-92
       Module not found: Error: Can't resolve '@graphql-mesh/merger-stitching' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/index.ts 19:15-44
       Module not found: Error: Can't resolve '@graphql-mesh/http' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/index.ts 20:18-50
       Module not found: Error: Can't resolve '@graphql-mesh/runtime' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/index.ts 21:16-46
       Module not found: Error: Can't resolve '@graphql-mesh/store' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/index.ts 22:24-62
       Module not found: Error: Can't resolve '@graphql-mesh/cross-helpers' in '/Users/yuri/Sites/igluu/igluu/igluu-app/libs/mesh/src/.mesh'
       
       ERROR in ./libs/mesh/src/.mesh/sources/GraphQL/types.ts:2:36
       TS2307: Cannot find module '@graphql-mesh/types' or its corresponding type declarations.
           1 |
         > 2 | import { InContextSdkMethod } from '@graphql-mesh/types';
             |                                    ^^^^^^^^^^^^^^^^^^^^^
           3 | import { MeshContext } from '@graphql-mesh/runtime';
           4 |
           5 | export namespace GraphQlTypes {
       
       ERROR in ./libs/mesh/src/.mesh/sources/GraphQL/types.ts:3:29
       TS2307: Cannot find module '@graphql-mesh/runtime' or its corresponding type declarations.
           1 |
           2 | import { InContextSdkMethod } from '@graphql-mesh/types';
         > 3 | import { MeshContext } from '@graphql-mesh/runtime';
             |                             ^^^^^^^^^^^^^^^^^^^^^^^
           4 |
           5 | export namespace GraphQlTypes {
           6 |   export type Maybe<T> = T | null;
       
       ERROR in ./libs/mesh/src/.mesh/sources/OrderApi/types.ts:2:36
       TS2307: Cannot find module '@graphql-mesh/types' or its corresponding type declarations.
           1 |
         > 2 | import { InContextSdkMethod } from '@graphql-mesh/types';
             |                                    ^^^^^^^^^^^^^^^^^^^^^
           3 | import { MeshContext } from '@graphql-mesh/runtime';
           4 |
           5 | export namespace OrderApiTypes {
       
       ERROR in ./libs/mesh/src/.mesh/sources/OrderApi/types.ts:3:29
       TS2307: Cannot find module '@graphql-mesh/runtime' or its corresponding type declarations.
           1 |
           2 | import { InContextSdkMethod } from '@graphql-mesh/types';
         > 3 | import { MeshContext } from '@graphql-mesh/runtime';
             |                             ^^^^^^^^^^^^^^^^^^^^^^^
           4 |
           5 | export namespace OrderApiTypes {
           6 |   export type Maybe<T> = T | null;
       
       ERROR in ./libs/mesh/src/.mesh/sources/RealkoExport/types.ts:2:36
       TS2307: Cannot find module '@graphql-mesh/types' or its corresponding type declarations.
           1 |
         > 2 | import { InContextSdkMethod } from '@graphql-mesh/types';
             |                                    ^^^^^^^^^^^^^^^^^^^^^
           3 | import { MeshContext } from '@graphql-mesh/runtime';
           4 |
           5 | export namespace RealkoExportTypes {
       
       ERROR in ./libs/mesh/src/.mesh/sources/RealkoExport/types.ts:3:29
       TS2307: Cannot find module '@graphql-mesh/runtime' or its corresponding type declarations.
           1 |
           2 | import { InContextSdkMethod } from '@graphql-mesh/types';
         > 3 | import { MeshContext } from '@graphql-mesh/runtime';
             |                             ^^^^^^^^^^^^^^^^^^^^^^^
           4 |
           5 | export namespace RealkoExportTypes {
           6 |   export type Maybe<T> = T | null;

To Reproduce Steps to reproduce the behavior:

Replacing yarn/npm in any example should do the trick.

  • Take the simplest example like https://github.com/Urigo/graphql-mesh/tree/master/examples/hello-world
  • Run pnpm install
  • Run mesh build
  • Check .mesh/index.ts, remove // @ts-nocheck and you'll see a lot of missing deps.

Expected behavior

Mesh generated files should have all peer deps installed/linked right

Environment:

  • OS: macOS, Linux
  •   "@graphql-mesh/graphql": "^0.31.5",
      "@graphql-mesh/json-schema": "^0.35.6",
      "@graphql-mesh/merger-bare": "^0.15.19",
      "@graphql-mesh/openapi": "^0.33.7",
      "@graphql-mesh/transform-naming-convention": "^0.10.75",
      "@graphql-mesh/transform-prefix": "^0.11.74",
      "@graphql-mesh/transform-resolvers-composition": "^0.12.84",
      "@graphql-mesh/utils": "^0.41.5",
    
  • NodeJS: 16.
  • I use pnpm with auto-install-peers=true flag enabled

Additional context

nezdemkovski avatar Sep 08 '22 10:09 nezdemkovski

I don't know much about pnpm. I'd recommend to use Yarn v1 as we do in the project.

ardatan avatar Sep 09 '22 11:09 ardatan

@nezdemkovski Did you manage to use pnpm with Mesh finally?

mnlbox avatar Jun 05 '23 10:06 mnlbox

@nezdemkovski Did you manage to use pnpm with Mesh finally?

nope, we got rid of Mesh at the end of the day 😅

nezdemkovski avatar Jun 05 '23 10:06 nezdemkovski

Closing the issue then. Feel free to create a new issue with a reproduction on CodeSandbox if someone else has the same issue.

ardatan avatar Jun 05 '23 11:06 ardatan

Using mesh with pnpm fine here FWIW.

dpnova avatar Nov 27 '23 00:11 dpnova