-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.ts
More file actions
29 lines (26 loc) · 745 Bytes
/
vite.config.ts
File metadata and controls
29 lines (26 loc) · 745 Bytes
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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import { existsSync } from "fs";
import packageJSON from "./package.json";
const getMockSettings = (isWeb = false) => {
const localSettingsPath = resolve(__dirname, "mocks/settings.local.json");
if (isWeb && existsSync(localSettingsPath)) {
return require(localSettingsPath);
}
return {};
};
// https://vitejs.dev/config/
export default defineConfig(async ({ command, mode }) => {
return {
plugins: [react()],
base: "./",
build: {
target: "esnext",
},
define: {
mockSettings: getMockSettings(mode === "web"),
__APP_VERSION__: JSON.stringify(packageJSON.version),
},
};
});