This repository was archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
76 lines (73 loc) · 2.21 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { defineConfig } from "vite";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
import dts from "vite-plugin-dts";
import svgr from "vite-plugin-svgr";
import react from "@vitejs/plugin-react-swc";
import path, { resolve } from "path";
import tailwindcss from "tailwindcss";
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
entry: {
index: resolve(__dirname, "./src/index.ts"),
checker: resolve(__dirname, "./src/features/checker/index.ts"),
hooks: resolve(__dirname, "./src/hooks/index.ts"),
icons: resolve(__dirname, "./src/assets/icons/index.ts"),
lib: resolve(__dirname, "./src/lib/index.ts"),
mainAll: resolve(__dirname, "./src/mainAll.ts"),
mocks: resolve(__dirname, "./src/mocks/handlers.ts"),
types: resolve(__dirname, "./src/types/index.ts"),
},
name: "gitcoin-ui",
fileName: (format: any, filename: any) => `${filename}.js`,
formats: ["es"],
},
rollupOptions: {
external: ["react", "react-dom", "tailwindcss"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
tailwindcss: "tailwindcss",
},
preserveModules: true,
preserveModulesRoot: "src",
},
},
sourcemap: true,
emptyOutDir: true,
minify: false,
target: "esnext",
},
plugins: [
react(),
svgr(),
dts({ rollupTypes: true }),
cssInjectedByJsPlugin({
styleId: "gitcoin-ui",
jsAssetsFilterFunction: function customJsAssetsfilterFunction(outputChunk) {
return (
outputChunk.preliminaryFileName.includes("!~{") || // for storybook build
outputChunk.fileName == "index.js" ||
outputChunk.fileName == "checker.js" ||
outputChunk.fileName == "hooks.js" ||
outputChunk.fileName == "icons.js" ||
outputChunk.fileName == "lib.js" ||
outputChunk.fileName == "mocks.js"
);
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"~checker": path.resolve(__dirname, "./src/features/checker"),
},
},
css: {
postcss: {
plugins: [tailwindcss],
},
},
});