Fix preview not working (#2962)

pull/2964/head
Hariom Balhara 2022-06-04 18:47:02 +05:30 committed by GitHub
parent 16836d0cfb
commit 1c89afc7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,21 @@ process.env.EMBED_PUBLIC_VERCEL_URL = process.env.VERCEL_URL;
process.env.EMBED_PUBLIC_WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL; process.env.EMBED_PUBLIC_WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL;
process.env.EMBED_PUBLIC_EMBED_LIB_URL = process.env.NEXT_PUBLIC_EMBED_LIB_URL; process.env.EMBED_PUBLIC_EMBED_LIB_URL = process.env.NEXT_PUBLIC_EMBED_LIB_URL;
// Problem: typeof process.env.EMBED_PUBLIC_EMBED_LIB_URL is "undefined"(truthy) if process.env.NEXT_PUBLIC_EMBED_LIB_URL is undefined(falsy)
// This is probably because environment variables are always string, so this weird automatic conversion to string happens
// HACKY Solution
if (process.env.EMBED_PUBLIC_EMBED_LIB_URL === "undefined") {
delete process.env.EMBED_PUBLIC_EMBED_LIB_URL;
}
if (process.env.EMBED_PUBLIC_WEBAPP_URL === "undefined") {
delete process.env.EMBED_PUBLIC_WEBAPP_URL;
}
if (process.env.EMBED_PUBLIC_VERCEL_URL === "undefined") {
delete process.env.EMBED_PUBLIC_VERCEL_URL;
}
const viteBaseConfig = { const viteBaseConfig = {
envPrefix: "EMBED_PUBLIC_", envPrefix: "EMBED_PUBLIC_",
}; };