feat: Deploy to Cloudflare workers
Some checks failed
Deployment / wordpress (push) Failing after 1s
Deployment / nuxt (push) Failing after 7s

This commit is contained in:
2026-01-27 19:59:34 -05:00
parent a1a8114f49
commit c6dfbeb247
12 changed files with 1139 additions and 381 deletions

View File

@@ -1,3 +1,13 @@
const siteUrl = process.env.NUXT_SITE_URL;
if (!siteUrl) {
throw new Error(`NUXT_SITE_URL is not defined. Make sure to set it in your build environment variables.`);
}
const wpUrl = process.env.NUXT_WP_URL;
if (!wpUrl) {
throw new Error(`NUXT_WP_URL is not defined. Make sure to set it in your build environment variables.`);
}
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
@@ -20,7 +30,7 @@ export default defineNuxtConfig({
css: ["~/assets/css/_main.css"],
site: {
url: process.env.NUXT_SITE_URL || undefined,
url: siteUrl,
name: "WP Headless",
defaultLocale: "fr",
},
@@ -31,6 +41,23 @@ export default defineNuxtConfig({
compatibilityDate: "2026-01-01",
nitro: {
preset: "cloudflare_module",
cloudflare: {
deployConfig: true,
nodeCompat: true,
wrangler: {
name: "foobar",
compatibility_date: "2026-01-27",
vars: {
NODE_ENV: "production",
NUXT_SITE_URL: siteUrl,
NUXT_WP_URL: wpUrl,
},
},
},
},
eslint: {
config: {
stylistic: {
@@ -45,19 +72,15 @@ export default defineNuxtConfig({
graphql: {
server: {
context: ["~~/server/graphql/context"],
context: ["server/graphql/context"],
schema: {
wp: {
type: "remote",
endpoint: `${process.env.NUXT_WP_URL}/graphql`,
hooks: ["~~/server/graphql/wp-hooks"],
},
wp: { type: "remote", endpoint: `${wpUrl}/graphql`, hooks: ["server/graphql/wp-hooks"] },
},
},
},
robots: {
sitemap: `${process.env.NUXT_WP_URL}/sitemap_index.xml`,
sitemap: `${wpUrl}/sitemap_index.xml`,
},
sitemap: false,