-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
39 lines (37 loc) · 990 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 path from "node:path";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import dts from "vite-plugin-dts";
import swc from "unplugin-swc";
import { defineConfig, PluginOption } from "vite";
import { vanillaExtractPlugin } from '@vanilla-extract/rollup-plugin';
import pkg from "./package.json";
export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: pkg.name,
formats: ["es", "umd"],
fileName: (format) => `index.${format}.js`,
},
emptyOutDir: true,
rollupOptions: {
external: [...Object.keys(pkg.peerDependencies), "react/jsx-runtime"],
output: {
globals: {
'react': 'React'
}
}
},
},
plugins: [
vanillaExtractPlugin(),
react(),
tsconfigPaths(),
swc.vite(),
swc.rollup({
minify: true,
}) as PluginOption,
dts({ insertTypesEntry: true, include: ["src"] }),
],
});