-
Notifications
You must be signed in to change notification settings - Fork 111
/
vite.config.ts
45 lines (42 loc) · 1.04 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
import { execSync } from "node:child_process";
import { resolve } from "node:path";
import react from "@vitejs/plugin-react";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig } from "vite";
import EnvironmentPlugin from "vite-plugin-environment";
let hash = "";
try {
hash = execSync("git rev-parse --short HEAD").toString().trim();
} catch (error) {
hash = "DEVELOPMENT";
}
export default defineConfig({
plugins: [
react(),
EnvironmentPlugin({
COMMIT_HASH: hash,
}),
// VitePWA({
// registerType: "autoUpdate",
// devOptions: {
// enabled: true
// }
// })
],
build: {
target: "esnext",
assetsDir: "",
rollupOptions: {
plugins: [visualizer()],
},
},
resolve: {
alias: {
"@app": resolve(__dirname, "./src"),
"@pages": resolve(__dirname, "./src/pages"),
"@components": resolve(__dirname, "./src/components"),
"@core": resolve(__dirname, "./src/core"),
"@layouts": resolve(__dirname, "./src/layouts"),
},
},
});