2 | Oh no... {{ error }}
3 |
4 |
5 | {{ data.hello }}
6 |
7 |
8 |
9 |
10 |
13 |
--------------------------------------------------------------------------------
/examples/minimal/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | import { defineNuxtConfig } from "nuxt3";
2 |
3 | export default defineNuxtConfig({
4 | buildModules: ["@nuxt3-graphql/urql", "@nuxt3-graphql/codegen"],
5 | urql: {
6 | url: process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}/api/graphql` : "http://localhost:3000/api/graphql",
7 | },
8 | });
9 |
--------------------------------------------------------------------------------
/examples/minimal/server/schema.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from "path";
2 | import { makeSchema } from "nexus";
3 | import * as types from "./types";
4 |
5 | export const schema = makeSchema({
6 | types,
7 | outputs: {
8 | schema: resolve(process.cwd(), "generated/schema.graphql"),
9 | },
10 | shouldGenerateArtifacts: process.env.NODE_ENV === "development",
11 | });
12 |
--------------------------------------------------------------------------------
/packages/codegen/build.config.ts:
--------------------------------------------------------------------------------
1 | import { defineBuildConfig } from "unbuild";
2 |
3 | export default defineBuildConfig({
4 | declaration: true,
5 | emitCJS: false,
6 | entries: [{ input: "./src/index" }],
7 | externals: [
8 | "@graphql-codegen/cli",
9 | "@graphql-codegen/plugin-helpers",
10 | "@nuxt/kit",
11 | "@nuxt/schema",
12 | "consola",
13 | "graphql",
14 | ],
15 | });
16 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "module": "ESNext",
5 | "moduleResolution": "node",
6 | "outDir": "dist",
7 | "declaration": true,
8 | "esModuleInterop": true,
9 | "strict": true,
10 | "resolveJsonModule": true,
11 | "skipLibCheck": true,
12 | "types": [
13 | "@nuxt/types"
14 | ]
15 | },
16 | "exclude": [
17 | "**/dist/**",
18 | "**/.output/**"
19 | ]
20 | }
--------------------------------------------------------------------------------
/packages/codegen/src/types.ts:
--------------------------------------------------------------------------------
1 | import type { Types } from "@graphql-codegen/plugin-helpers";
2 |
3 | export type NuxtCodegenConfig = Types.Config & {};
4 |
5 | type NuxtHookResult = Promise