forked from figma/sds
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.lib.config.ts
More file actions
61 lines (59 loc) · 1.74 KB
/
vite.lib.config.ts
File metadata and controls
61 lines (59 loc) · 1.74 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
import react from "@vitejs/plugin-react";
import { dirname, resolve } from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "vite";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
data: resolve(__dirname, "src/data"),
compositions: resolve(__dirname, "src/ui/compositions"),
hooks: resolve(__dirname, "src/ui/hooks"),
icons: resolve(__dirname, "src/ui/icons"),
images: resolve(__dirname, "src/ui/images"),
layout: resolve(__dirname, "src/ui/layout"),
primitives: resolve(__dirname, "src/ui/primitives"),
utils: resolve(__dirname, "src/ui/utils"),
types: resolve(__dirname, "src/types"),
},
},
build: {
lib: {
entry: resolve(__dirname, "src/ui/index.ts"),
name: "SDS",
fileName: (format) => `index.${format}.js`,
formats: ["es"],
},
rollupOptions: {
external: [
"react",
"react-dom",
"react/jsx-runtime",
"react-aria-components",
],
output: {
assetFileNames: () => {
return "index.css";
},
globals: {
react: "React",
"react-dom": "ReactDOM",
"react/jsx-runtime": "JSXRuntime",
"react-aria-components": "ReactAriaComponents",
},
manualChunks: {
icons: ["src/ui/icons/index.ts"],
primitives: ["src/ui/primitives/index.ts"],
compositions: ["src/ui/compositions/index.ts"],
layout: ["src/ui/layout/index.ts"],
},
},
},
sourcemap: true,
// Ensure CSS is included in the bundle
cssCodeSplit: false,
copyPublicDir: false,
},
});