Hemmelig.app/vite.config.js

35 lines
877 B
JavaScript
Raw Permalink Normal View History

2024-10-29 18:53:43 +01:00
import react from '@vitejs/plugin-react';
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';
const path = fileURLToPath(import.meta.url);
const root = resolve(dirname(path), 'client');
// 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()],
},
2024-10-29 18:53:43 +01:00
},
define: {
'import.meta.env.VITE_GIT_SHA': JSON.stringify(getGitInfo().sha),
'import.meta.env.VITE_GIT_TAG': JSON.stringify(getGitInfo().tag),
},
});