39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import dts from "vite-plugin-dts";
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
dts({
|
|
tsconfigPath: "../../tsconfig.json",
|
|
include: ["src"],
|
|
entryRoot: "src",
|
|
aliasesExclude: ["@heroui-vue/styles"],
|
|
// ESM consumers using NodeNext require extensions even in declarations.
|
|
// Foo.vue.js resolves Foo.vue.d.ts; plain Foo.vue only works in bundler mode.
|
|
beforeWriteFile(filePath, content) {
|
|
return {
|
|
filePath,
|
|
content: content.replace(
|
|
/((?:from\s+|import\s*\(\s*)["'])(\.{1,2}\/[^"']+)(["'])/g,
|
|
(_match, prefix: string, path: string, suffix: string) => {
|
|
const target = /\.(?:[cm]?js|json|css)$/.test(path)
|
|
? path
|
|
: /\.ts$/.test(path)
|
|
? path.slice(0, -3) + ".js"
|
|
: path + ".js";
|
|
return prefix + target + suffix;
|
|
},
|
|
),
|
|
};
|
|
},
|
|
}),
|
|
],
|
|
build: {
|
|
lib: { entry: "src/index.ts", formats: ["es"], fileName: "index" },
|
|
rollupOptions: {
|
|
external: ["vue", "reka-ui", "@heroui-vue/styles", "@vueuse/core"],
|
|
},
|
|
},
|
|
});
|