fix: don't throw on missing process.env.NUXT_WP_URL

This commit is contained in:
2026-03-26 11:48:46 -04:00
parent dfbbda7856
commit ff01a43288

View File

@@ -1,12 +1,5 @@
import { version } from "./package.json"; import { version } from "./package.json";
// 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 // https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: ["@lewebsimple/nuxt-graphql", "@nuxt/ui", "nuxt-svgo"], modules: ["@lewebsimple/nuxt-graphql", "@nuxt/ui", "nuxt-svgo"],
@@ -23,6 +16,10 @@ export default defineNuxtConfig({
}, },
ui: { colorMode: false }, ui: { colorMode: false },
runtimeConfig: {
wpUrl: "",
},
graphql: { graphql: {
client: { client: {
cache: { cache: {
@@ -30,7 +27,7 @@ export default defineNuxtConfig({
}, },
}, },
server: { server: {
schema: [{ type: "remote", endpoint: `${wpUrl}/graphql` }], schema: [{ type: "remote", endpoint: `${process.env.NUXT_WP_URL}/graphql` }],
}, },
}, },