import { fileURLToPath, URL } from "node:url"; import { defineConfig } from "vite"; import Vue from "@vitejs/plugin-vue"; import { resolve } from "node:path"; import Markdown from "vite-plugin-md"; import postcss from "postcss"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ Vue({ include: [/\.vue$/, /\.md$/], }), Markdown({ markdownItSetup(md) { // add anchor links to your H[x] tags md.use(require("markdown-it-anchor")); }, }), ], build: { lib: { entry: resolve(__dirname, "packages/index.ts"), name: "nlxxUi", fileName: "nlxxUi-lib", formats: ["es", "umd"], }, outDir: resolve(__dirname, "lib/"), rollupOptions: { // 确保外部化处理那些你不想打包进库的依赖 external: ["vue"], output: { // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量 globals: { vue: "Vue", }, }, }, }, resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, });