apollo icon indicating copy to clipboard operation
apollo copied to clipboard

feat: support apollo-upload-client

Open art-boer opened this issue 2 years ago • 12 comments

Support for apollo-upload-client

Sometimes you want your client to be able to communicate with a GraphQL server that has uploads enabled, however, you would also need a HttpLink that supports the uploading of files.

In this MR I have created a conditional option (per client) for using the Upload HttpLink instead of the default Apollo HttpLink.

art-boer avatar Nov 09 '22 16:11 art-boer

Deploy Preview for apollo-module canceled.

Name Link
Latest commit c16100675d89008ac9e3c503b0e7d599ec3f3a33
Latest deploy log https://app.netlify.com/sites/apollo-module/deploys/636cbb8d92af74000915ae8c

netlify[bot] avatar Nov 09 '22 16:11 netlify[bot]

Since Vite/Rollup does not always support CJS to ESM I have used the @originjs/vite-plugin-commonjs plugin to be able to use apollo-upload-client. Webpack does not seem to have this issue.

See: https://github.com/jaydenseric/apollo-upload-client/issues/280

art-boer avatar Nov 10 '22 08:11 art-boer

thank you @art-boer! Im slowly moving to nuxt3 and wanted to implement the same. I hope this PR will be merged soon

LorDeCry avatar Dec 08 '22 02:12 LorDeCry

@Diizzayy Any chance to have a look at it yet? If you need me to look at an alternative implementation or solution for the ESM import then let me know! I would love to help out.

art-boer avatar Dec 08 '22 15:12 art-boer

Deploy Preview for apollo-module canceled.

Name Link
Latest commit 91cd01b3bb44200175b43c830bdb8b5c4555cac8
Latest deploy log https://app.netlify.com/sites/apollo-module/deploys/63972389941f0d00080427d3

netlify[bot] avatar Dec 12 '22 12:12 netlify[bot]

@Diizzayy I have found a better way to fix the import of apollo-upload-client, without using yet another Vite plugin. A simple alias for 'apollo-upload-client' pointing towards the index.mjs file does the trick!

art-boer avatar Dec 12 '22 12:12 art-boer

@Diizzayy I have found a better way to fix the import of apollo-upload-client, without using yet another Vite plugin. A simple alias for 'apollo-upload-client' pointing towards the index.mjs file does the trick!

I tried it and it works. Tks @art-boer I hope this PR will be merged soon

thanhhauqn07 avatar Dec 16 '22 06:12 thanhhauqn07

any updates here guys

proalaa avatar Apr 16 '23 13:04 proalaa

is there a reason this has not been reviewed yet or is there another implementation?

ybtam avatar Aug 29 '23 08:08 ybtam

Is there a reason this PR hasn't been merged? Not being able to handle file uploads is a blocker for many projects, which creates a trap for those upgrading from Nuxt 2. Nuxt 2 Apollo doesn't work on supported Node versions, and Nuxt 3 Apollo is missing this critical feature. There's no obvious workaround for this without support in the module.

LeoAdamek avatar Mar 12 '24 16:03 LeoAdamek

any updates?

datge avatar Apr 30 '24 12:04 datge

any updates?

Luferov avatar Aug 09 '24 12:08 Luferov