diff --git a/src/utils/load-nezha-v0-config.js b/src/utils/load-nezha-v0-config.js index 036c8f8..f1d0e39 100644 --- a/src/utils/load-nezha-v0-config.js +++ b/src/utils/load-nezha-v0-config.js @@ -6,7 +6,7 @@ function getNezhaConfigUrl() { return nezhaPath; } const a = document.createElement('a'); - if (nezhaPath === '/nezha/' && import.meta.env.VITE_BASE_PATH !== '/') { + if (nezhaPath === '/nezha/' && (import.meta.env.VITE_BASE_PATH && import.meta.env.VITE_BASE_PATH !== '/')) { [a.href] = window.location.href.split(import.meta.env.VITE_BASE_PATH); } else { a.href = nezhaPath; diff --git a/vite.config.js b/vite.config.js index e5f9eb9..a95b5a3 100644 --- a/vite.config.js +++ b/vite.config.js @@ -42,7 +42,7 @@ if (process.env.NODE_ENV === 'development') { }, }; - if (process.env.VITE_BASE_PATH === '/') { + if (process.env.VITE_BASE_PATH === '/' || !process.env.VITE_BASE_PATH) { proxy['/nezha/'] = { target: process.env.NEZHA_HOST, changeOrigin: true,