-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
39 lines (38 loc) · 987 Bytes
/
Copy pathvite.config.ts
File metadata and controls
39 lines (38 loc) · 987 Bytes
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
/*
* @Date: 2025-09-25 14:06:37
* @LastEditors: Do not edit
* @LastEditTime: 2025-09-25 18:02:14
* @FilePath: \sourceHTML\preload-screen\vite.config.ts
*/
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import libCss from "vite-plugin-libcss";
export default defineConfig({
build: {
lib: {
entry: "src/index.ts",
name: "PreloadScreen", // 必须,UMD/IIFE 全局变量名
formats: ["es", "umd"],
fileName: (format) => `preload-screen.${format}.js`,
},
rollupOptions: {
// 不打包依赖(用户自己提供)
external: [],
output: {
globals: {},
},
},
},
plugins: [
// 生成 .d.ts 类型声明
dts({
// 输出目录统一放到 dist/types
outDir: "dist/types",
// 在 index.d.ts 中生成类型入口
insertTypesEntry: true,
// 确保生成的类型声明不会被 tree-shake 掉
rollupTypes: true,
}),
libCss(),
],
});