forked from adrhumphreys/tahua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
37 lines (36 loc) · 1.12 KB
/
vite.config.ts
File metadata and controls
37 lines (36 loc) · 1.12 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
import { vanillaExtractPlugin } from "@vanilla-extract/rollup-plugin";
import { visualizer } from "rollup-plugin-visualizer";
import preserveDirectives from "rollup-plugin-preserve-directives";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
import { defineConfig } from "vite";
import { resolve } from "path";
export default defineConfig({
plugins: [
dts(),
react(),
vanillaExtractPlugin(),
preserveDirectives({ supressPreserveModulesWarning: true }),
...(process.env.VISUALIZER ? [visualizer()] : []),
],
build: {
lib: {
entry: {
index: resolve(__dirname, "src", "index.tsx"),
global: resolve(__dirname, "src", "styles", "global.ts"),
},
formats: ["es"],
},
rollupOptions: {
external: ["react", "react-dom", "react/jsx-runtime"],
output: {
// This allows us to only import the Button.css when the Button is used
// rather than bundling it all together and importing all the css all the
// time.
preserveModules: true,
preserveModulesRoot: "src",
},
},
sourcemap: true,
},
});