-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
62 lines (60 loc) · 1.56 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
50
51
52
53
54
55
56
57
58
59
60
61
62
/// <reference types="vitest" />
import * as path from 'node:path';
import vuePlugin from '@vitejs/plugin-vue';
import vueJsxPlugin from '@vitejs/plugin-vue-jsx';
import { InlineConfig, defineConfig, mergeConfig } from 'vite';
// 组件库打包、组件文档、组件单元测试共用
export const baseConfig: InlineConfig = {
resolve: {
alias: [
{
find: '@common',
replacement: path.resolve(__dirname, './packages/common'),
},
{
find: '@components',
replacement: path.resolve(__dirname, './packages/components'),
},
{
find: '@hooks',
replacement: path.resolve(__dirname, './packages/hooks'),
},
{
find: '@typings',
replacement: path.resolve(__dirname, './public/lib/typings'),
},
],
},
css: {
preprocessorOptions: {
/** 配置 scss 全局变量的引入方式 */
scss: {
additionalData: `@import "@common/styles/variable.scss";\n@import "@common/styles/reset.scss";`,
},
},
},
};
// https://vitejs.dev/config/
export default defineConfig(
mergeConfig(baseConfig, {
server: {
port: 5174,
},
// 单元测试相关配置
test: {
globals: true,
environment: 'jsdom',
include: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'],
// include: ['**/*/__tests__/Tooltip.test.ts'],
exclude: [
'**/*/__tests__/Select.test.ts',
'**/node_modules/**',
'**/dist/**',
'**/cypress/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
],
},
plugins: [vuePlugin(), vueJsxPlugin()],
} as InlineConfig),
);