Search code examples
graphqlnuxt.jsapollo

Nuxt.js 2.13 full static still try to fetch data from apollo on routing


  • Nuxt.js 2.13
  • target: static
  • @nuxtjs/apollo
  • data coming from an headless cms

example:

import blogQuery from '~/apollo/queries/blog.gql'

data () {
  return {
    blog: []
  }
},
apollo: {
  blog: {
    query: blogQuery
  }
}
  • nuxt build && nuxt export

I'd expect no more data fetch, but this is still happening on the exported static website

What can be going wrong?

Any help appreciated, thanks!


Solution

  • As discussed in this issue, apollo smart queries aren't supported with the new target: static. You need to use asyncData or the new fetch (for components and layouts)