Releases

v8.0.0 5/10/2024

What's Changed

BREAKING CHANGES

v7.0.0 9/12/2023

What's Changed

BREAKING CHANGES

  • Drop for Nuxt 2 support, to continue using nuxt-graphql-request with Nuxt 2, stick to v6: yarn add nuxt-graphql-request@v6.
  • Remove file uploads feature

Features:

  • Nuxt 3 support, thanks to @nicktrn #53
  • Bump graphql-request to v6
  • Bump cross-fetch to v4 (support for Node 18 and 20)
  • gql file imports are now vite and webpack compatible
  • automatic type generation
  • responses can be fully typed with TypedDocumentNode (used by two of the test pages as examples)

Fixes:

  • defining a client at runtime only now works as expected

v6.0.0 9/2/2022

v4.0.0 2/22/2021

BREAKING CHANGES

https://github.com/Gomah/nuxt-graphql-request/pull/13 Supports multiple clients, thanks @samturrell

Change to nuxt.config as v4 now supports multiple clients:

Before:

module.exports = {
  buildModules: ['nuxt-graphql-request'],

  graphql: {
    /**
     * The client endpoint url
     */
    endpoint: 'https://swapi-graphql.netlify.com/.netlify/functions/index',

    /**
     * Options
     * See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
     */
    options: {},

    /**
     * Optional
     * default: true (this includes cross-fetch/polyfill before creating the graphql client)
     */
    useFetchPolyfill: true,

    /**
     * Optional
     * default: false (this includes graphql-tag for node_modules folder)
     */
    includeNodeModules: true,
  },
};

After:

module.exports = {
  buildModules: ['nuxt-graphql-request'],

  graphql: {
    /**
     * An Object of your GraphQL clients
     */
    clients: {
      default: {
        /**
         * The client endpoint url
         */
        endpoint: 'https://swapi-graphql.netlify.com/.netlify/functions/index',
        /**
         * Per-client options overrides
         * See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
         */
        options: {},
      },
      secondClient: {
        // ...client config
      },
      // ...your other clients
    },

    /**
     * Options
     * See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
     */
    options: {},

    /**
     * Optional
     * default: true (this includes cross-fetch/polyfill before creating the graphql client)
     */
    useFetchPolyfill: true,

    /**
     * Optional
     * default: false (this includes graphql-tag for node_modules folder)
     */
    includeNodeModules: true,
  },
};