fix: don't throw on missing process.env.NUXT_WP_URL
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
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
|
||||
export default defineNuxtConfig({
|
||||
modules: ["@lewebsimple/nuxt-graphql", "@nuxt/ui", "nuxt-svgo"],
|
||||
@@ -23,6 +16,10 @@ export default defineNuxtConfig({
|
||||
},
|
||||
ui: { colorMode: false },
|
||||
|
||||
runtimeConfig: {
|
||||
wpUrl: "",
|
||||
},
|
||||
|
||||
graphql: {
|
||||
client: {
|
||||
cache: {
|
||||
@@ -30,7 +27,7 @@ export default defineNuxtConfig({
|
||||
},
|
||||
},
|
||||
server: {
|
||||
schema: [{ type: "remote", endpoint: `${wpUrl}/graphql` }],
|
||||
schema: [{ type: "remote", endpoint: `${process.env.NUXT_WP_URL}/graphql` }],
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user