-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
37 lines (34 loc) · 902 Bytes
/
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
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import { resolve } from "path";
import { existsSync } from "fs";
import path from "path";
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: [vue()],
base: "./",
build: {
target: "esnext",
outDir: "dist",
emptyOutDir: true,
},
define: {
mockSettings: getMockSettings(mode === "web"),
__APP_VERSION__: JSON.stringify(packageJSON.version),
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
};
});