-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
76 lines (75 loc) · 1.79 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/// <reference types="vitest" />
import { resolve } from "node:path";
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import unocss from "unocss/vite";
import { Prefix } from "./composables/constant/url";
export default defineConfig(({ mode }) => {
const { SERVER_RUNNING_PORT } = loadEnv(mode, process.cwd(), "SERVER_RUNNING_PORT");
return {
define: {
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false
},
plugins: [
vue({
script: {
propsDestructure: true,
defineModel: true
}
}),
vueJsx(),
unocss()
],
server: {
port: 20018,
proxy: {
"/request": {
target: `http://localhost:${SERVER_RUNNING_PORT}/${Prefix.Server}`,
changeOrigin: true,
rewrite: path => path.replace(/^\/request/, "")
}
}
},
envPrefix: [
"PROJECT_NAME",
"I18N_DEFAULT_LANG",
"STYLE_ASIDE_WIDTH",
"STYLE_ASIDE_MODULES_WIDTH",
"STYLE_COLLAPSE_WIDTH",
"STYLE_ANIMATION_DURATION",
"STYLE_EXTEND_WIDTH",
"STYLE_BASE_FONT_SIZE",
"BUILD_ENCRYPTED_KEY",
"BUILD_IV",
"STYLE_HEADER_HEIGHT",
"SERVER_RUNNING_PORT",
"EMAIL"
],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
"#": resolve(__dirname)
}
},
test: {
root: "src",
include: ["composables/**/*.spec.ts", "src/**/*.spec.ts"],
environment: "jsdom",
transformMode: {
web: [/.[tj]sx$/]
}
},
ssr: {
external: ["node-fetch"],
format: "cjs"
},
build: {
rollupOptions: {
external: ["node-fetch"]
}
}
};
});