-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
37 lines (35 loc) · 978 Bytes
/
Copy pathvite.config.ts
File metadata and controls
37 lines (35 loc) · 978 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
34
35
36
37
import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import { realpathSync, lstatSync } from 'fs';
import { dirname, resolve } from 'path';
// When node_modules is a symlink (sandbox env), Vite's fs security blocks
// serving files from outside the project root. Detect and allow the target.
function getSymlinkAllowPaths(): string[] {
const nmPath = resolve('node_modules');
try {
if (lstatSync(nmPath).isSymbolicLink()) {
return [dirname(realpathSync(nmPath))];
}
} catch {
// node_modules doesn't exist yet
}
return [];
}
export default defineConfig({
plugins: [tailwindcss(), sveltekit()],
server: {
fs: {
allow: getSymlinkAllowPaths()
}
},
test: {
globals: true,
environment: 'happy-dom',
include: ['src/**/*.{test,spec}.{js,ts}'],
coverage: {
reporter: ['text', 'json', 'html'],
exclude: ['**/*.config.*', '**/types/**', '**/*.d.ts']
}
}
});