Browse Source

feat: add TypeScript declarations and source maps for better IDE support

dev
hechang27-sprt 6 months ago
parent
commit
b50147b9c4
  1. 12
      vite.config.ts

12
vite.config.ts

@ -1,6 +1,7 @@ @@ -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 }) => { @@ -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"),

Loading…
Cancel
Save