-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.config.ts
More file actions
37 lines (32 loc) · 1.08 KB
/
vite.config.ts
File metadata and controls
37 lines (32 loc) · 1.08 KB
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
34
35
36
37
/// <reference types="vitest" />
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, type PluginOption } from 'vite';
import { coverageConfigDefaults } from 'vitest/config';
import basicSsl from '@vitejs/plugin-basic-ssl';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
const changelogPath = fileURLToPath(new URL('CHANGELOG.md', import.meta.url));
const changelog = readFileSync(changelogPath, 'utf8');
export default defineConfig((env) => {
const plugins: PluginOption[] = [sveltekit()];
// When running `vite dev`
if (env.command === 'serve') {
// Useful to test certain APIs like `navigator.share` which are only available on HTTPS.
// Running `npm run start:https` will automatically use this flag
if (process.env.DEV_HTTPS) {
plugins.push(basicSsl());
}
}
return {
test: {
include: ['tests/app/**/*.ts'],
coverage: {
exclude: ['build/**', 'scripts/**', 'discord/**', 'svelte.config.js', ...coverageConfigDefaults.exclude],
},
},
plugins,
define: {
__CHANGELOG__: JSON.stringify(changelog),
},
};
});