apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Can't use apollo composables when @vue/apollo-composable isn't directly inside node_modules

Open oosame opened this issue 2 years ago • 3 comments

Environment

  • Operating System: Linux
  • Node Version: v16.20.0
  • Nuxt Version: 3.6.0
  • Nitro Version: -
  • Package Manager: NPM
  • Builder: webpack
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Describe the bug

using useLazyAsyncQuery or any of the other apollo composable but useAsyncQuery results in the following import bug

[plugin:vite:import-analysis] Failed to resolve import "@vue/apollo-composable" from "pages/sink.vue". Does the file exist?

image

Expected behaviour

I should be able to use the other composables according to the docs, right?

Reproduction

No response

Additional context

No response

Logs

No response

oosame avatar Jun 26 '23 11:06 oosame

I have the same issue. It was working fine until I installed GraphQL Code Generator.. This changed the dependency tree so that the @vue/apollo-composable package was no longer at ./node_modules/@vue/apollo-composable (where this package expects it to be) and was moved to ./node_modules/@nuxtjs/apollo/node_modules/@vue/apollo-composable.

This package needs to resolve the location of @vue/apollo-composable according to the node module resolution algorithm, instead of assuming it to be directly inside node_modules.

@oosame Could you maybe update the issue title to be more accurate? (Since sometimes you can use apollo composables). Something like "Can't use apollo composables when @vue/apollo-composable isn't directly inside node_modules?

zenflow avatar Jul 01 '23 22:07 zenflow

@Diizzayy could you kindly give us a hand?

oosame avatar Jul 06 '23 12:07 oosame

any updates on this? i have same error

AlexanderBredun avatar Aug 11 '23 08:08 AlexanderBredun

@Diizzayy did you link this issue accidentally? This has nothing to do with reactivity or type hints and all to do with module resolution. Thanks!

zenflow avatar Mar 01 '24 21:03 zenflow

@zenflow no, there have been slight changes which has thus far proven to fix this issue, hence why it has been closed until further notice ( will be revisited if needed )

Diizzayy avatar Mar 01 '24 21:03 Diizzayy

Great news @Diizzayy thank you!!

zenflow avatar Mar 01 '24 21:03 zenflow