-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
56 lines (52 loc) · 1.34 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
46
47
48
49
50
51
52
53
54
55
56
import cp from "node:child_process";
import path from "node:path";
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
import viteReact from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import packageJson from "./package.json";
const commitHash = cp
.execSync("git rev-parse --short HEAD")
.toString()
.replace("\n", "");
const APP_VERSION = `${packageJson.version}-${commitHash}`;
// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
return {
plugins: [
TanStackRouterVite({
routesDirectory: "./src/routes",
generatedRouteTree: "./src/route-tree.gen.ts",
routeFileIgnorePrefix: "-",
quoteStyle: "double",
autoCodeSplitting: true,
indexToken: "_index",
routeToken: "_route",
disableManifestGeneration: true,
}),
viteReact({
babel: {
plugins: [
[
"babel-plugin-react-compiler",
{ runtimeModule: "react-compiler-runtime" },
],
],
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
port: 3000,
},
build: {
sourcemap: command === "serve",
},
define: {
"import.meta.env.APP_VERSION": JSON.stringify(APP_VERSION),
},
};
});