-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
49 lines (44 loc) · 1.01 KB
/
vite.config.ts
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
/// <reference types="vitest" />
import { dependencies, name } from './package.json'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import path from 'node:path'
const libName = name.replace(/^@.*\//, '')
export default defineConfig({
resolve: {
alias: {
'~/': `${path.resolve(__dirname, 'src')}/`,
'~': `${path.resolve(__dirname, 'src')}`,
'#/': `${path.resolve(__dirname, 'test')}/`,
'#': `${path.resolve(__dirname, 'test')}`,
},
},
build: {
lib: {
name: libName,
entry: 'src/index.ts',
fileName: format => `${libName}.${format}.js`,
formats: ['es', 'cjs', 'umd'],
},
rollupOptions: {
external: Object.keys(dependencies),
},
sourcemap: true,
},
plugins: [
dts({
rollupTypes: true,
include: ['src/**/*'],
outDir: '.',
}),
],
optimizeDeps: {
exclude: ['vue-demi'],
},
test: {
coverage: {
reporter: ['text', 'json', 'html'],
include: ['src/**'],
},
},
})