chore(frontend): make vite dev runnable outside Docker
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s
Allow overriding the dep-optimizer cache dir via VITE_CACHE_DIR (the default node_modules/.vite is root-owned when built in Docker) and honor a PORT injected by the harness. Both default to prior behavior when the env vars are unset, so Docker builds are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,9 @@ import path from 'path'
|
||||
const backendUrl = process.env.BACKEND_URL ?? 'http://localhost:8000'
|
||||
|
||||
export default defineConfig({
|
||||
// Allow overriding the dep-optimizer cache dir (default node_modules/.vite is
|
||||
// owned by root when the image is built in Docker, so local `vite` can't write).
|
||||
cacheDir: process.env.VITE_CACHE_DIR || undefined,
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
@@ -13,6 +16,9 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
server: {
|
||||
// Honor a port injected by the harness (e.g. preview autoPort); falls back to
|
||||
// Vite's default 5173 when unset.
|
||||
port: process.env.PORT ? Number(process.env.PORT) : undefined,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: backendUrl,
|
||||
|
||||
Reference in New Issue
Block a user