feat: Setup GraphQL with dynamic node routing logic

This commit is contained in:
2026-03-18 23:21:05 -04:00
parent 1838d59382
commit 3b72a16f86
9 changed files with 1291 additions and 73 deletions

View File

@@ -1,13 +1,36 @@
// WordPress backend URL (required)
const wpUrl = process.env.NUXT_WP_URL;
if (!wpUrl) {
throw new Error("NUXT_WP_URL environment variable is not set");
}
console.log(`${wpUrl}/graphql`);
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ["@nuxt/ui", "nuxt-svgo"],
modules: ["@lewebsimple/nuxt-graphql", "@nuxt/ui", "nuxt-svgo"],
compatibilityDate: "2026-03-18",
devtools: { enabled: true },
vite: {
optimizeDeps: {
include: ["@vue/devtools-core", "@vue/devtools-kit", "zod"],
},
},
graphql: {
server: {
schema: [{ type: "remote", endpoint: `${wpUrl}/graphql` }],
},
},
ui: { colorMode: false },
css: ["~/assets/css/_main.css"],
components: { dirs: [{ path: "~/components", pathPrefix: false }] },
components: {
dirs: [
{ path: "~/components/nodes", global: true },
{ path: "~/components", pathPrefix: false },
],
},
svgo: {
autoImportPath: "~/assets/svg/",