-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
55 lines (54 loc) · 1.36 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
52
53
54
55
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tsConfigPaths from "vite-tsconfig-paths";
import dts from "vite-plugin-dts";
import { resolve } from "path";
export default defineConfig({
plugins: [
react(),
tsConfigPaths(),
dts({
include: ["lib/**/*.{ts,tsx}"],
exclude: ["lib/**/*.test.ts", "lib/**/*.test.tsx"],
outDir: "dist",
rollupTypes: true,
insertTypesEntry: true,
tsconfigPath: resolve(__dirname, "./tsconfig.json"),
}),
],
build: {
lib: {
entry: resolve(__dirname, "lib/main.tsx"),
formats: ["es", "umd", "cjs"],
name: "ReactMasonify",
fileName: (format) => {
switch (format) {
case "es":
return "react-masonify.es.js";
case "umd":
return "react-masonify.umd.js";
case "cjs":
return "react-masonify.cjs.js";
default:
return "react-masonify.js";
}
},
},
rollupOptions: {
external: ["react", "react/jsx-runtime", "react-dom"],
output: {
exports: "named",
globals: {
react: "React",
"react/jsx-runtime": "jsxRuntime",
"react-dom": "ReactDOM",
},
},
},
sourcemap: true,
minify: "esbuild",
cssMinify: true,
outDir: "dist",
emptyOutDir: true,
},
});