Problems with fetch when running shopify-buy sdk in SSR environment
[issue link]I have setup shopify-buy as a plugin in my project running with the ssr: false flag. Unfortunately i am still running into the problem that the server is complaining about missing fetch function.
After a bit of digging i can see that fetch is utilized from graphql-js-client in shopify-buy, but what i do not understand is that when i switch off ssr why is the plugin still missing fetch? When i turn nuxt into spa mode it is working smoothly.
nuxt.config.js
plugins: [
{src: '~/plugins/shopify-buy', ssr: false},
],
build: {
vendor: [
'shopify-buy'
]
}
plugins/shopify-buy.js
import Client, {Config} from 'shopify-buy'
const shopifyConfig = new Config({
domain: 'removed.com',
storefrontAccessToken: 'hidden'
})
export const shopifyClient = new Client(shopifyConfig)