-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.ts
47 lines (44 loc) · 1.05 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
import { defineConfig, Plugin } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJSX from "@vitejs/plugin-vue-jsx";
import Unocss from "./packages/pup-ui/config/unocss";
import type { UserConfig as VitestUserConfigInterface } from "vitest/config";
import path from "path";
const rollupOptions = {
external: ["vue"],
output: {
globals: {
vue: "Vue",
},
},
};
export const config = {
plugins: [vue() as Plugin, vueJSX() as Plugin, Unocss() as Plugin[]],
build: {
rollupOptions,
minify: "terser",
sourcemap: true,
brotliSize: true,
// cssCodeSplit: true,
lib: {
entry: path.resolve(__dirname, "./packages/pup-ui/src/entry.ts"),
name: "PupUI",
fileName: "pup-ui",
formats: ["esm", "umd", "iife"],
},
outDir: "./dist",
},
test: {
globals: true,
environment: "happy-dom",
// 支持tsx组件,很关键
transformMode: {
web: [/.[tj]sx$/],
},
coverage: {
provider: "istanbul", // or 'c8',
reporter: ["text", "json", "html"],
},
},
};
export default defineConfig(config as VitestUserConfigInterface);