lewebsimple

@nuxt3 graphql/codegen

GraphQL Code Generator for Nuxt.js! ⚡️

Version Version: 0.4.0 Version Updated: 04/06/2022 By: lewebsimple License: MIT

DownloadsLast30Days: 140

https://github.com/lewebsimple/nuxt3-graphql

npm i @nuxt3-graphql/codegen
yarn add @nuxt3-graphql/codegen

@nuxt3-graphql/codegen

GraphQL Code Generator for Nuxt.js! ⚡️

Features

  • Load your codegen config file from the root of your Nuxt3 project
  • Generate code from your GraphQL schema and operations on every build and in dev mode

Install

yarn add -D @nuxt3-graphql/codegen @graphql-codegen/cli graphql
# npm i -D @nuxt3-graphql/codegen @graphql-codegen/cli graphql

Create a condegen config file either manually or with the wizard:

yarn graphql-codegen init

Usage

Within your nuxt.config.js add the following:

import { defineNuxtConfig } from "nuxt3";

export default defineNuxtConfig({
  buildModules: [
    "@nuxt3-graphql/codegen",
  ],
});

This will automativally generate the GraphQL code based on your codegen config file each time Nuxt builds your project (this also works in dev mode).

Refer to the GraphQL Code Generator documentation for more information.

Categories: GraphQLUtilities

Copyright © 2020 vuejscomponent.com