From b50147b9c473b3cdf2a4db22e4b121454f8d59fd Mon Sep 17 00:00:00 2001 From: hechang27-sprt Date: Sat, 27 Dec 2025 00:03:12 +0800 Subject: [PATCH] feat: add TypeScript declarations and source maps for better IDE support --- vite.config.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index ef63fc1..a695920 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import legacy from "@vitejs/plugin-legacy"; +import dts from "vite-plugin-dts"; import { resolve } from "path"; export default defineConfig(({ command, mode }) => { @@ -18,10 +19,21 @@ export default defineConfig(({ command, mode }) => { legacy({ targets: ["defaults", "not IE 11"], }), + // Generate TypeScript declaration files for library builds + isLibBuild && + dts({ + include: ["**/*.ts", "**/*.vue"], + exclude: ["node_modules", "dist", "dist-examples", "examples"], + outDir: "dist", + staticImport: true, + insertTypesEntry: true, + rollupTypes: false, + }), ].filter(Boolean), build: isLibBuild ? { // Library build configuration + sourcemap: true, lib: { entry: { index: resolve(__dirname, "index.ts"),