-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.mts
More file actions
55 lines (51 loc) · 1.16 KB
/
vite.config.mts
File metadata and controls
55 lines (51 loc) · 1.16 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { copyFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import dts from 'vite-plugin-dts';
import { defineConfig } from 'vitest/config';
export default defineConfig({
build: {
lib: {
entry: resolve(import.meta.dirname, 'src/index.ts'),
name: 'decycle',
formats: ['cjs', 'es', 'umd'],
fileName: (format) => {
switch (format) {
case 'cjs':
return 'index.cjs';
case 'es':
return 'index.mjs';
case 'umd':
return 'index.umd.js';
default:
return `index.${format}.js`;
}
},
},
sourcemap: true,
},
plugins: [
dts({
rollupTypes: true,
async afterBuild() {
const outDir = resolve(import.meta.dirname, 'dist');
await Promise.all(
['cts', 'mts'].map((extension) =>
copyFile(
resolve(outDir, 'index.d.ts'),
resolve(outDir, `index.d.${extension}`),
),
),
);
},
}),
],
test: {
globals: true,
coverage: {
enabled: true,
thresholds: {
100: true,
},
},
},
});