-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.lib.ts
More file actions
66 lines (65 loc) · 1.83 KB
/
vite.config.lib.ts
File metadata and controls
66 lines (65 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { glob } from "glob"
import { resolve } from "path"
import { defineConfig } from "vite"
import dts from "vite-plugin-dts"
import solid from "vite-plugin-solid"
import tailwindcss from "@tailwindcss/vite"
export default defineConfig({
resolve: {
alias: {
"@": new URL("./src", import.meta.url).pathname,
"~ui": new URL("./lib", import.meta.url).pathname,
"~utils": new URL("././node_modules/@adaptive-sm/utils/dist", import.meta.url).pathname,
},
},
plugins: [
solid(),
tailwindcss(),
dts({
include: ["lib/**/*"],
outDir: "dist",
// Use your tsconfig.lib.json for proper configuration
tsconfigPath: "./tsconfig.lib.json",
}),
],
build: {
copyPublicDir: false,
lib: {
// Entry point(s) for your library
// entry: resolve(__dirname, "lib/**/*.{ts,tsx}"),
entry: glob.sync(resolve(__dirname, "lib/**/*.{ts,tsx}"), {
ignore: ["**/*.test.ts", "**/*.test.tsx"],
}),
// Output formats - ESM is standard for modern libraries
formats: ["es"],
},
outDir: "dist",
// Don't minify library code - let consumers decide
minify: false,
sourcemap: true,
rollupOptions: {
// Externalize dependencies that shouldn't be bundled
external: [
"solid-js",
"solid-js/web",
"solid-js/store",
"@adaptive-sm/utils",
"@mdi/js",
"@solid-primitives/keyed",
"@solid-primitives/scheduled",
"@solidjs/router",
"clsx",
"dayjs",
"tailwind-merge",
"valibot",
/^node:.*$/, // Externalize all node imports
/^bun:.*$/, // Externalize all bun imports
],
output: {
// Preserve module structure for better tree-shaking
preserveModules: true,
preserveModulesRoot: "lib",
},
},
},
})