-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.mts
41 lines (38 loc) · 1.08 KB
/
vite.config.mts
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
import react from "@vitejs/plugin-react";
import { resolve } from "node:path";
import dts from "vite-plugin-dts";
import { libInjectCss } from "vite-plugin-lib-inject-css";
import { setEnv } from "./.vite/commands/setEnv";
import { svgrPlugin } from "./.vite/plugins/svgr";
import pkg from "./package.json";
import { defineConfig } from "vite";
export default defineConfig(({ mode }) => {
setEnv(mode);
return {
build: {
...(mode === "development" ? { sourcemap: "inline" } : {}),
...(mode === "development" ? { emptyOutDir: false } : {}),
outDir: "build",
lib: {
entry: resolve(__dirname, "src/index.tsx"),
formats: ["es"],
},
rollupOptions: {
external: [...Object.keys(pkg.peerDependencies)],
output: {
assetFileNames: "assets/[name][extname]",
entryFileNames: "[name].js",
},
},
},
plugins: [
react(),
svgrPlugin(),
libInjectCss(),
dts({
include: ["src"],
...(mode === "development" ? {} : { rollupTypes: true }),
}),
],
};
});