-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.lib.ts
41 lines (38 loc) · 1.04 KB
/
vite.config.lib.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
// 编译 lib 配置文件
import baseConfig from "./vite.config";
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import libCss from "vite-plugin-libcss";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineConfig({
...baseConfig,
build: {
outDir: "dist",
lib: {
entry: resolve(__dirname, "./packages/jet-plan-ui/index.ts"),
fileName: format => `jet-plan-ui.${format}.js`,
formats: ["es", "cjs", "umd"],
name: "jetPlanUI",
},
sourcemap: true,
rollupOptions: {
external: ["vue", "highlight.js", "@highlightjs/vue-plugin"],
output: {
globals: {
vue: "Vue",
highlightJs: "highlight.js",
highlightjsVuePlugin: "@highlightjs/vue-plugin",
},
},
},
},
plugins: [
vue(),
libCss(),
dts({ tsConfigFilePath: "./tsconfig.vitest.json" }),
],
});