From 809733351044be761e88f3166b3deb7d6d3607e3 Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Fri, 11 Aug 2023 16:02:20 -0700 Subject: [PATCH] feat: add env for allowing console logs on build --- web/.env.example | 1 + web/helpers/functions.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/.env.example b/web/.env.example index 3fe854eb2..cda728699 100644 --- a/web/.env.example +++ b/web/.env.example @@ -2,3 +2,4 @@ VITE_ACCOUNT=https://localhost:8008 VITE_CONNECT=https://connect.myunraid.net VITE_UNRAID_NET=https://unraid.ddev.site VITE_CALLBACK_KEY=aNotSoSecretKeyUsedToObfuscateQueryParams +VITE_ALLOW_CONSOLE_LOGS=false \ No newline at end of file diff --git a/web/helpers/functions.ts b/web/helpers/functions.ts index b7d6ab733..9c34883b1 100644 --- a/web/helpers/functions.ts +++ b/web/helpers/functions.ts @@ -2,7 +2,7 @@ export const OBJ_TO_STR = (obj: object): string => Object.entries(obj).reduce((str, [p, val]) => `${str}${p}: ${val}\n`, ''); /** Removes our dev logs from prod builds */ export const disableProductionConsoleLogs = () => { - if (import.meta.env.PROD) { + if (import.meta.env.PROD && !import.meta.env.VITE_ALLOW_CONSOLE_LOGS) { console.log = () => {}; console.debug = () => {}; console.info = () => {};