-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.mts
68 lines (67 loc) · 1.74 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
58
59
60
61
62
63
64
65
66
67
68
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({
deps: true,
devDeps: true,
peerDeps: true,
optionalDeps: true,
nodeBuiltins: true,
}),
dts({
include: 'src',
}),
],
define: {
'process.env.PKG_NAME': JSON.stringify(pkg.name),
'process.env.PKG_VERSION': JSON.stringify(pkg.version),
'process.env.PKG_DESCRIPTION': JSON.stringify(pkg.description),
},
build: {
minify: false,
sourcemap: true,
copyPublicDir: false,
reportCompressedSize: false,
lib: {
entry: {
index: 'src/index.ts',
},
},
rollupOptions: {
output: [
{
format: 'esm',
entryFileNames: '[name].mjs',
chunkFileNames: '[name].mjs',
},
{
format: 'cjs',
entryFileNames: '[name].cjs',
chunkFileNames: '[name].cjs',
},
],
},
},
test: {
globals: true,
env: {
PKG_NAME: 'pkg-name-for-test',
PKG_VERSION: 'pkg-version-for-test',
PKG_DESCRIPTION: 'pkg-description-for-test',
},
coverage: {
all: true,
include: ['src/**/*.ts'],
reporter: ['lcov', 'text'],
},
},
});