feat: apollo-client-upload support by Anumide · Pull Request #669 · nuxt-modules/apollo
🔗 Linked issue
Resolves #553
❓ Type of change
- 📖 Documentation (updates to the documentation or readme)
- 🐞 Bug fix (a non-breaking change that fixes an issue)
- 👌 Enhancement (improving an existing functionality)
- ✨ New feature (a non-breaking change that adds functionality)
- 🧹 Chore (updates to the build process or auxiliary tools and libraries)
- ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
The Nuxt Apollo module currently does not support file or Blob uploads when using useMutation, forcing developers to rely on custom workarounds or abandon the module.
This PR adds first-class support for file uploads by integrating apollo-upload-client and updating the Apollo client plugin to use an upload-enabled link by default.
What’s included
-
Adds file and
Blobupload support viaapollo-upload-client -
Uses the upload link as the default
httpLink -
Introduces a
useApolloUploadLinkoption:true(default): enables file uploadsfalse: falls back to the nativehttpLink
This preserves backward compatibility while giving users full control.
Why this change is needed
Without this support, developers must:
- Create custom Apollo client setups just to enable uploads(my situation and many of developers), or
- Stop using the Nuxt Apollo module altogether
This PR removes that friction and provides an out-of-the-box solution that aligns with common GraphQL use cases.
Version compatibility
This PR uses apollo-upload-client@v18, which is compatible with the current dependency stack.
I have also prepared a separate branch using v19. It is available here:
https://github.com/Anumide/nuxt-apollo/tree/feat/v19-apollo-client-upload
Supporting v19 requires dependency upgrades, which are already being addressed in related PRs:
- chore(deps): update dependency @apollo/client to v4 #656
- chore(deps): update devdependency @eslint/compat to v2 #666
- chore(deps): update dependency docus to v5 #660
- chore(deps): update devdependency @nuxt/ui to v4 #659
I’m happy to follow up with an updated PR once those changes land.