-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
43 lines (40 loc) · 1.11 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
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import inject from "@rollup/plugin-inject";
import commonjs from "@rollup/plugin-commonjs";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const isDevelopment = mode === "development";
return {
plugins: [
vue(),
isDevelopment && commonjs(),
isDevelopment &&
inject({ Buffer: ["buffer", "Buffer"], process: "process" }),
].filter(Boolean),
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
"balm-ui-plus": "balm-ui/dist/balm-ui-plus.esm.js",
"balm-ui-css": "balm-ui/dist/balm-ui.css",
process: "process/browser",
},
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis",
},
},
},
build: {
rollupOptions: {
plugins: [
// Conditionally include inject plugin during build if needed
inject({ Buffer: ["buffer", "Buffer"], process: "process" }),
],
},
},
};
});