-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.mts
57 lines (56 loc) · 1.18 KB
/
vite.config.mts
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
import { externalizeDeps } from 'vite-plugin-externalize-deps';
import dts from 'vite-plugin-dts';
import { defineConfig } from 'vitest/config';
import pkg from './package.json';
/**
* vite config
* @ref https://vitejs.dev/
* vitest config
* @ref https://vitest.dev/
*/
export default defineConfig({
plugins: [
externalizeDeps(),
dts({
outDir: 'dist',
entryRoot: 'src',
}),
],
define: {
PKG_NAME: JSON.stringify(pkg.name),
PKG_VERSION: JSON.stringify(process.env.VITEST ? '0.0.0' : pkg.version),
},
build: {
minify: false,
sourcemap: true,
copyPublicDir: false,
reportCompressedSize: false,
lib: {
entry: ['src/index.ts'],
},
rollupOptions: {
output: [
{
format: 'esm',
dir: 'dist',
entryFileNames: '[name].mjs',
chunkFileNames: '[name].mjs',
},
{
format: 'cjs',
dir: 'dist',
entryFileNames: '[name].cjs',
chunkFileNames: '[name].cjs',
},
],
},
},
test: {
globals: true,
coverage: {
all: true,
include: ['src/**/*.ts'],
reporter: ['lcov', 'text'],
},
},
});