-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (64 loc) · 1.53 KB
/
vite.config.ts
File metadata and controls
65 lines (64 loc) · 1.53 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
56
57
58
59
60
61
62
63
64
65
import { resolve } from 'path';
import { defineConfig } from 'vitest/config';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts';
import copy from 'vite-plugin-cp';
import pkg from './package.json';
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
extensions: ['.mts', '.ts', '.mjs', '.js', '.vue'],
alias: [
{
find: '@',
replacement: resolve(__dirname, 'src')
}
]
},
plugins: [
vue(),
copy({
targets: [{ src: './src/types.d.ts', dest: './dist' }]
}),
dts({
exclude: ['**/*.spec.ts', '**/*.stories.ts'],
insertTypesEntry: true
})
],
build: {
target: 'esnext',
outDir: 'dist',
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: pkg.name,
// the proper extensions will be added
fileName: pkg.name.replace('@', '').replace('/', '-')
},
rollupOptions: {
treeshake: true,
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['vue'],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: 'Vue'
},
sourcemapExcludeSources: true
}
}
},
test: {
globals: true,
environment: 'happy-dom',
coverage: {
enabled: true,
reporter: ['text', 'json', 'html'],
all: true,
include: ['src/components/**/*.vue']
},
restoreMocks: true,
setupFiles: ['./vitest.setup.ts']
}
});