campfire/vite.config.js

28 lines
766 B
JavaScript
Raw Normal View History

2024-06-29 10:46:27 +01:00
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
2024-06-30 19:57:32 +01:00
import svg from '@poppanator/sveltekit-svg'
2025-07-21 19:49:55 +01:00
import { execSync } from 'child_process';
2024-06-29 10:46:27 +01:00
2025-07-21 19:49:55 +01:00
// get ver from package.json
2024-06-29 10:46:27 +01:00
const packageFile = fileURLToPath(new URL('package.json', import.meta.url));
const packageData = readFileSync(packageFile, 'utf8');
const packageJSON = JSON.parse(packageData);
2025-07-21 19:49:55 +01:00
// get git commit hash
const commitHash = execSync("git rev-parse HEAD")
.toString().trim().slice(0, 10)
export default defineConfig({
2024-06-30 19:57:32 +01:00
plugins: [
sveltekit(),
svg()
],
2024-06-29 10:46:27 +01:00
define: {
2025-07-21 19:49:55 +01:00
APP_VERSION: JSON.stringify(packageJSON.version),
APP_COMMIT: `"${commitHash}"`
2024-06-29 10:46:27 +01:00
}
});