diff --git a/.env.example b/.env.example index f6af56d..8dc5ad0 100644 --- a/.env.example +++ b/.env.example @@ -11,3 +11,7 @@ APP_URL="MY_APP_URL" # VITE_ARK_API_KEY: Required for Doubao AI API calls. # Users should configure this in their environment variables. VITE_ARK_API_KEY= + +# VITE_BASE_URL: Optional base path for frontend assets and routes. +# Example: "/" for root deployment, "/scriptflow/" for subpath deployment. +VITE_BASE_URL=/ \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 1c24e77..8b01f7e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,7 @@ import {defineConfig, loadEnv} from 'vite'; export default defineConfig(({mode}) => { const env = loadEnv(mode, '.', ''); return { + base: env.VITE_BASE_URL || '/', plugins: [react(), tailwindcss()], define: { 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY), @@ -17,7 +18,7 @@ export default defineConfig(({mode}) => { }, server: { // HMR is disabled in AI Studio via DISABLE_HMR env var. - // Do not modify鑺掕仚鑱癴ile watching is disabled to prevent flickering during agent edits. + // Do not modify閼烘帟浠氶懕鐧磇le watching is disabled to prevent flickering during agent edits. hmr: process.env.DISABLE_HMR !== 'true', }, };