nuxt-graphql-codegen
GraphQL Code Generator module for Nuxt3 / Nuxt Bridge
1,551
14
| Install | |
|---|---|
npm install nuxt-graphql-codegen |
|
| Latest Version: | 0.3.3 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Sep 30, 2022 |
| Links: | GitHub · npm |
Maintainer: pascalmartineau
nuxt-graphql-codegen
GraphQL Code Generator module for Nuxt3 / Nuxt Bridge.
Quick setup
- Add
nuxt-graphql-codegendependency to your project
# Using yarn
yarn add -D nuxt-graphql-codegen
# Using npm
npm install --save-dev nuxt-graphql-codegen
Note you also need graphql, @graphql-codegen/cli and the plugins you want to use.
- Add
nuxt-graphql-codegento themodulessection of yournuxt.config.ts
import { defineNuxtConfig } from "nuxt";
export default defineNuxtConfig({
modules: ["nuxt-graphql-codegen"],
});
- Create your
codegen.ymlorcodegen.jsonconfiguration file in the project'srootDirwith the Initialization Wizard or manually
yarn graphql-codegen init
That's it! The code generator will now be executed before each build, it will also watch for changes in .graphql and .gql files in development mode.
Configuration
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: ["nuxt-graphql-codegen", {
/**
* @default false
*/
devOnly: boolean;
/**
* @default ['.graphql', '.gql']
*/
extensions: string[];
}],
});
Development
- Run
npm run dev:prepareto generate type stubs. - Use
npm run devto start playground in development mode.
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.3.3 | ^3.0 | MIT | |
| 0.3.2 | ^3.0 | MIT | |
| 0.3.1 | ^3.0 | MIT | |
| 0.3.0 | ^3.0 | MIT | |
| 0.2.0 | MIT | ||
| 0.1.4 | MIT | ||
| 0.1.3 | MIT | ||
| 0.1.2 | MIT | ||
| 0.1.1 | MIT | ||
| 0.1.0 | MIT |