Files
driver.js/vite.config.ts
Kamran Ahmed d9f20e9342 Replace dts-bundle-generator with vite-plugin-dts
- Generate the bundled dist/driver.js.d.ts during `vite build` via
  vite-plugin-dts (bundleTypes), dropping the separate
  dts-bundle-generator step and its config
- Explicitly re-export the public types (Config, Popover, Side, etc.)
  from the entry so the bundled .d.ts keeps the same export surface;
  api-extractor only exports what the entry exports

Verified: the generated .d.ts has an identical export surface and
semantically identical type bodies to the previous output (12 types).
2026-06-23 10:10:02 +01:00

45 lines
983 B
TypeScript

/// <reference types="vitest/config" />
import path from "path";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
const packageName = "driver.js";
const fileName = {
es: `${packageName}.mjs`,
cjs: `${packageName}.cjs`,
iife: `${packageName}.iife.js`,
};
const formats = Object.keys(fileName) as Array<keyof typeof fileName>;
export default defineConfig({
base: "./",
plugins: [
dts({
bundleTypes: true,
tsconfigPath: "./tsconfig.json",
}),
],
build: {
target: "es2020",
lib: {
entry: path.resolve(__dirname, "src/driver.ts"),
name: packageName,
formats,
fileName: format => fileName[format],
},
rollupOptions: {
output: {
assetFileNames: assetInfo => {
const name = assetInfo.names?.[0] ?? assetInfo.name;
return name?.endsWith(".css") ? `driver.css` : (name as string);
},
},
},
},
test: {
environment: "jsdom",
},
});