-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
53 lines (50 loc) · 1.6 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
import {resolve} from "node:path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
import dts from "vite-plugin-dts";
const id: string = "/habitat/";
const isPROD: boolean = process.env.NODE_ENV === "production";
// https://vitejs.dev/config/
export default defineConfig({
base: isPROD ? id : "/",
build: {
lib: {
entry: {
badge: resolve(__dirname, "src/components/Badge"),
button: resolve(__dirname, "src/components/Button"),
checkbox: resolve(__dirname, "src/components/Checkbox"),
index: resolve(__dirname, "src/index.ts"),
reset: resolve(__dirname, "src/utils/reset.css.ts"),
switch: resolve(__dirname, "src/components/Switch"),
theme: resolve(__dirname, "src/utils/theme.ts"),
typography: resolve(__dirname, "src/components/Typography"),
},
formats: ["es","cjs"],
name: "@casavo/habitat",
},
rollupOptions: {
external: ["react", "react-dom"],
output: {
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
sourcemap: true,
ssrManifest: true,
target: "modules",
},
plugins: [
// we don't need to emit the types for the components if we are building the Storybook
process.env.npm_lifecycle_event === "build:components" &&
dts({
clearPureImport: false,
exclude: ["node_modules/**", "**/vite-env.d.ts"],
insertTypesEntry: true,
}),
react(),
vanillaExtractPlugin({ identifiers: "short" }),
],
});