fix: Cloudflare image provider only in production

This commit is contained in:
2026-01-30 12:20:30 -05:00
parent 4079e4ecfb
commit 291fa6eaa4
2 changed files with 5 additions and 4 deletions

View File

@@ -1,7 +1,5 @@
import { version } from "./package.json";
const isDev = process.env.NODE_ENV !== "production";
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.`);
@@ -13,6 +11,9 @@ if (!wpUrl) {
}
const wpDomain = new URL(wpUrl).hostname;
const isDev = process.env.NODE_ENV !== "production";
const isWranglerDev = process.env.WRANGLER_ENV === "dev";
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
@@ -102,7 +103,7 @@ export default defineNuxtConfig({
},
image: {
provider: isDev ? "ipx" : "cloudflare",
provider: isDev || isWranglerDev ? "none" : "cloudflare",
cloudflare: { baseURL: `${siteUrl}/` },
domains: [wpDomain],
format: ["avif", "webp"],

View File

@@ -10,7 +10,7 @@
"dev": "nuxt dev",
"lint": "eslint --fix .",
"postinstall": "nuxt prepare",
"preview": "pnpm run build && wrangler dev --port 3000",
"preview": "WRANGLER_ENV=dev pnpm run build && wrangler dev --port 3000",
"release": "pnpm lint && changelogen --noAuthors --release --push",
"typecheck": "nuxt typecheck"
},