-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
39 lines (36 loc) · 999 Bytes
/
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
import react from "@vitejs/plugin-react-swc";
import preserveDirectives from "rollup-preserve-directives";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import pkg from "./package.json" with { type: "json" };
const rootDir = "src";
export default defineConfig({
plugins: [
react(),
process.env.NO_DTS !== "true" && dts({ include: rootDir }),
],
build: {
lib: {
entry: [
`${rootDir}/mod.ts`,
`${rootDir}/styles/base.css`,
`${rootDir}/styles/standalone.css`,
`${rootDir}/tailwind-preset.ts`,
],
formats: ["es"],
},
cssCodeSplit: true,
sourcemap: true,
minify: false,
rollupOptions: {
external: [
...Object.keys(pkg.dependencies ?? {}),
...Object.keys(pkg.peerDependencies ?? {}),
].map((packageName) => new RegExp(`^${packageName}($|/)`, "u")),
plugins: [preserveDirectives()],
output: {
preserveModules: true,
},
},
},
});