From c86f46db17fe149240e30fa0748621239e36c72a Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 18 Sep 2024 14:52:56 -0500 Subject: [PATCH] Use dynamic base path for favicon images (#46719) --- web/packages/design/src/ThemeProvider/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/packages/design/src/ThemeProvider/index.tsx b/web/packages/design/src/ThemeProvider/index.tsx index 7cd3db621e618..5877ab9f8e8be 100644 --- a/web/packages/design/src/ThemeProvider/index.tsx +++ b/web/packages/design/src/ThemeProvider/index.tsx @@ -68,14 +68,18 @@ export function getPrefersDark(): boolean { } export function updateFavicon() { + let base = '/web/app/'; + if (import.meta.env.MODE === 'development') { + base = '/app/'; + } const darkModePreferred = getPrefersDark(); const favicon = document.querySelector('link[rel="icon"]'); if (favicon instanceof HTMLLinkElement) { if (darkModePreferred) { - favicon.href = '/app/favicon-dark.png'; + favicon.href = base + 'favicon-dark.png'; } else { - favicon.href = '/app/favicon-light.png'; + favicon.href = base + 'favicon-light.png'; } } }