feat: add env for allowing console logs on build

This commit is contained in:
Zack Spear
2023-08-11 16:02:20 -07:00
parent 06b97ba872
commit 8097333510
2 changed files with 2 additions and 1 deletions

View File

@@ -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

View File

@@ -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 = () => {};