代码提交
This commit is contained in:
1 parent
b101ee7fc9
commit
1938c80061
42 files changed
+5552
-278
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
// 两种构建:
|
||||
// - 默认(`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(), tailwindcss()],
|
||||
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",
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user