Files
learning-platform/vite.config.js
RaymondVerhoef 8a8745fad2
All checks were successful
On Push to Main / test (push) Successful in 30s
On Push to Main / publish (push) Successful in 59s
On Push to Main / deploy-dev (push) Successful in 1m33s
feat: show build SHA + timestamp in a small footer for deploy verification
Adds a BuildStamp component pinned to the bottom-right of every page
(desktop only, dim monospace text) so it's obvious at a glance which
build is currently running.

The git short SHA and an ISO build timestamp are injected at build time
via Vite's `define`, falling back to 'unknown' if git is not available.
ESLint config declares the two compile-time constants as readonly
globals so no per-file disable comments are needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:20:46 +02:00

40 lines
1.0 KiB
JavaScript

import { defineConfig } from 'vite'
import { execSync } from 'node:child_process'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
function getBuildSha() {
try {
return execSync('git rev-parse --short HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
.toString()
.trim()
} catch {
return 'unknown'
}
}
// https://vite.dev/config/
export default defineConfig({
define: {
__BUILD_SHA__: JSON.stringify(getBuildSha()),
__BUILD_TIME__: JSON.stringify(new Date().toISOString()),
},
plugins: [react(), tailwindcss()],
server: {
proxy: {
'/api/anthropic': {
target: 'https://api.anthropic.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/anthropic/, ''),
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
if (process.env.ANTHROPIC_API_KEY) {
proxyReq.setHeader('x-api-key', process.env.ANTHROPIC_API_KEY);
}
});
}
}
}
}
})