-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
33 lines (30 loc) · 908 Bytes
/
vite.config.ts
File metadata and controls
33 lines (30 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { readFileSync } from 'fs';
import { execSync } from 'child_process';
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
let commitHash = 'unknown';
try {
commitHash = execSync('git rev-parse --short HEAD').toString().trim();
} catch (e) {
if (process.env.CF_PAGES_COMMIT_SHA) {
commitHash = process.env.CF_PAGES_COMMIT_SHA.substring(0, 7);
}
}
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
__COMMIT_HASH__: JSON.stringify(commitHash)
},
plugins: [tailwindcss(), sveltekit()],
server: {
host: true,
allowedHosts: true,
watch: { usePolling: true },
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin'
}
}
});