-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
66 lines (63 loc) · 1.43 KB
/
vite.config.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { svelteTesting } from '@testing-library/svelte/vite';
import { configDefaults, defineConfig } from 'vitest/config';
import * as path from 'path';
import { fileURLToPath } from 'url';
let filename = fileURLToPath(import.meta.url);
const PACKAGE_ROOT = path.dirname(filename);
export default defineConfig({
mode: process.env.MODE,
root: PACKAGE_ROOT,
resolve: process.env.VITEST
? {
conditions: ['browser'],
alias: {
'$lib/': path.join(PACKAGE_ROOT, 'src/lib') + '/'
}
}
: {
alias: {
'$lib/': path.join(PACKAGE_ROOT, 'src/lib') + '/'
}
},
plugins: [
svelte({
compilerOptions: {
hmr: process.env.NODE_ENV !== 'production'
}
}),
svelteTesting()
],
test: {
// jest like globals
globals: true,
environment: 'happy-dom',
// in-source testing
includeSource: ['src/**/*.{js,ts,svelte}'],
// Exclude files in c8
coverage: {
exclude: ['test/setupTest.ts']
},
setupFiles: ['./test/setupTest.ts'],
// Exclude playwright tests folder
exclude: [...configDefaults.exclude, 'tests','docs'],
alias: [{ find: '@testing-library/svelte', replacement: '@testing-library/svelte/svelte5' }]
},
base: '',
server: {
fs: {
strict: true
}
},
build: {
sourcemap: true,
outDir: 'dist',
assetsDir: '.',
lib: {
entry: 'src/lib/index.ts',
formats: ['es']
},
emptyOutDir: true,
reportCompressedSize: false
}
});