4307955163
- vite.config.ts: read package.json and expose its version as a
build-time global via Vite's `define`.
- app.d.ts: add ambient declaration so the layout's brand version
badge (`v{__APP_VERSION__}`) type-checks.
25 lines
620 B
TypeScript
25 lines
620 B
TypeScript
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { defineConfig } from 'vite';
|
|
import { readFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const pkg = JSON.parse(
|
|
readFileSync(fileURLToPath(new URL('./package.json', import.meta.url)), 'utf8'),
|
|
);
|
|
|
|
export default defineConfig({
|
|
plugins: [tailwindcss(), sveltekit()],
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
},
|
|
server: {
|
|
port: 5175,
|
|
proxy: {
|
|
'/api': 'http://localhost:8420',
|
|
'/docs': 'http://localhost:8420',
|
|
'/openapi.json': 'http://localhost:8420'
|
|
}
|
|
}
|
|
});
|