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

Incompatible module imports with Yarn Berry

Open snikch opened this issue 1 year ago • 1 comments

Issue workflow progress

  • [x] 1. The issue provides a reproduction available on CodeSandbox
  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

💥 🕸️  Mesh Error: Unable to load cache matching localforage while resolving @graphql-mesh/localforage: Error: @graphql-mesh/utils tried to access @graphql-mesh/localforage, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Mesh cli cannot be run in yarn 3 due to import errors.

To Reproduce Steps to reproduce the behavior:

Simply follow the installation instructions on the website and try run mesh dev with Yarn.

Additional context

Some of this appears to be an issue with the way the import name is generated, as it's importing @graphql-mesh/localforage not @graphql-mesh/cache-localforage. If I add a cache config with the key cache-localforage and add the package then the cache import works.

cache:
  cache-localforage:
    driver: [WEBSQL, INDEXEDDB, LOCALSTORAGE]

However, the underlying issue reappears with different imports that I'm not in control of:

💥 🕸️  Mesh Error: Unable to load merger matching bare while resolving @graphql-mesh/bare: Error: @graphql-mesh/utils tried to access @graphql-mesh/bare, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

This should be @graphql-mesh/merger-bare I believe.

snikch avatar May 21 '23 00:05 snikch

I don't know much about Yarn Berry and I have never used it. PRs are welcome to fix it!

ardatan avatar Jun 12 '23 10:06 ardatan