forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
32 lines (30 loc) · 826 Bytes
/
vite.config.js
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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import { viteExternalsPlugin } from "vite-plugin-externals";
import { globSync } from "glob";
const tsxFiles = globSync("./src/**/*.tsx");
export default defineConfig({
plugins: [
react(),
viteExternalsPlugin({
react: "React",
"react/jsx-runtime": "jsxRuntime",
"@withfig/api-bindings": "figApiBindings",
}),
],
build: {
outDir: resolve(__dirname, "build", "components"),
lib: {
formats: ["es"],
name: "preview",
// eslint-disable-next-line compat/compat
entry: Object.fromEntries(
tsxFiles.map((file) => [
file.replace("./src/", "").replace(".tsx", ""),
resolve(__dirname, file),
])
),
},
},
});