Files
deerflow-code/parallel-agents-vue/vite.config.ts
T
2026-06-10 12:51:13 +08:00

40 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// 两种构建:
// - 默认(`vite build` / `vite dev`):独立 demo 应用(index.html)。
// - `--mode lib`(`pnpm build:lib`):组件库,产出 ESM + UMD + 一个 style.css,
// 供其它 Vue 项目 `import { ParallelAgentsPanel } from "parallel-agents-vue"`。
export default defineConfig(({ mode }) => {
const isLib = mode === "lib";
return {
plugins: [vue()],
resolve: {
alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) },
},
server: { port: 5183 },
build: isLib
? {
lib: {
entry: fileURLToPath(new URL("./src/index.ts", import.meta.url)),
name: "ParallelAgentsVue",
fileName: "parallel-agents-vue",
},
rollupOptions: {
// vue 由宿主提供,不打进库。
external: ["vue"],
output: {
exports: "named",
globals: { vue: "Vue" },
assetFileNames: "parallel-agents-vue.[ext]",
},
},
cssCodeSplit: false,
}
: {
outDir: "dist-app",
},
};
});