fix: Cloudflare image provider only in production
This commit is contained in:
@@ -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"],
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user