-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
51 lines (48 loc) · 1.27 KB
/
vite.config.ts
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
/* eslint-disable no-undef */
import { resolve } from "path";
import { defineConfig, UserConfig } from "vite";
import dtsPlugin from "vite-plugin-dts";
export function viteConfig(path: string[], config?: UserConfig) {
return defineConfig({
plugins: [
dtsPlugin({
insertTypesEntry: true,
outDir: "lib/types",
include: ["src/**/*.ts", "src/**/*.tsx", "../core/src/**/*.ts"],
exclude: ["**/__tests__", "**/example"],
}),
...(config?.plugins || []),
],
resolve: {
preserveSymlinks: true,
},
build: {
outDir: "lib",
minify: false,
reportCompressedSize: true,
...config?.build,
terserOptions: {
compress: false,
mangle: false,
keep_classnames: true,
...config?.build?.terserOptions,
},
rollupOptions: {
preserveEntrySignatures: "allow-extension",
cache: false,
...config?.build?.rollupOptions,
external: [
...((config?.build?.rollupOptions?.external || []) as string[]),
],
},
lib: {
name: "Genshi",
formats: ["es", "cjs"],
fileName: "index",
...config?.build?.lib,
entry: resolve(...path),
},
},
});
}
export default viteConfig([]);