2024-10-29 18:53:43 +01:00
|
|
|
import react from '@vitejs/plugin-react';
|
2024-03-11 13:43:20 +01:00
|
|
|
import { dirname, resolve } from 'node:path';
|
|
|
|
import { fileURLToPath } from 'node:url';
|
2024-10-29 19:53:48 +01:00
|
|
|
import tailwindcss from 'tailwindcss';
|
2024-10-29 18:53:43 +01:00
|
|
|
import { defineConfig } from 'vite';
|
2024-03-11 13:43:20 +01:00
|
|
|
|
|
|
|
const path = fileURLToPath(import.meta.url);
|
|
|
|
const root = resolve(dirname(path), 'client');
|
2023-04-02 17:18:19 +02:00
|
|
|
|
2025-02-07 15:15:09 +01:00
|
|
|
// Get git info
|
|
|
|
const getGitInfo = () => {
|
|
|
|
const sha = process.env.GIT_SHA || 'main';
|
|
|
|
const tag = process.env.GIT_TAG || 'latest';
|
|
|
|
|
|
|
|
return { sha, tag };
|
|
|
|
};
|
|
|
|
|
2024-10-29 18:53:43 +01:00
|
|
|
export default defineConfig({
|
|
|
|
root,
|
|
|
|
build: {
|
2024-10-29 19:53:48 +01:00
|
|
|
outDir: resolve(root, 'build'),
|
2024-10-29 18:53:43 +01:00
|
|
|
},
|
|
|
|
publicDir: 'public',
|
|
|
|
plugins: [react()],
|
|
|
|
css: {
|
|
|
|
postcss: {
|
|
|
|
plugins: [tailwindcss()],
|
2023-04-02 17:18:19 +02:00
|
|
|
},
|
2024-10-29 18:53:43 +01:00
|
|
|
},
|
2025-02-07 15:15:09 +01:00
|
|
|
define: {
|
|
|
|
'import.meta.env.VITE_GIT_SHA': JSON.stringify(getGitInfo().sha),
|
|
|
|
'import.meta.env.VITE_GIT_TAG': JSON.stringify(getGitInfo().tag),
|
|
|
|
},
|
2023-04-02 17:18:19 +02:00
|
|
|
});
|