-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
51 lines (49 loc) · 1.34 KB
/
vite.config.js
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
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue2";
import { VuetifyResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";
import { visualizer } from "rollup-plugin-visualizer";
import { fileURLToPath, URL } from "node:url";
export default (configEnv) => {
process.env = {
...process.env,
...loadEnv(configEnv.mode, process.cwd(), ""),
};
return defineConfig({
base: process.env.VITE_APP_BASE_URL,
plugins: [
vue(),
Components({
directoryAsNamespace: true,
resolvers: [
// Vuetify
VuetifyResolver(),
],
}),
visualizer({
template: "treemap", // or sunburst
open: true,
gzipSize: true,
brotliSize: true,
filename: "analyse.html", // will be saved in project's root
}),
],
css: {
preprocessorOptions: {
sass: {
additionalData: [
'@import "./src/styles/variables"',
'@import "vuetify/src/styles/settings/_variables"',
"", // end with newline
].join("\n"),
},
},
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
});
};