-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
executable file
·54 lines (54 loc) · 1.47 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
import type { ConfigEnv } from "vite";
import { loadEnv } from "vite";
import { createProxy, wrapperEnv } from "./build/utils";
import alias from "./build/vite/alias";
import { getPluginsList } from "./build/vite/plugin/index";
// https://vitejs.dev/config/
export default ({ command, mode }: ConfigEnv) => {
const root = process.cwd();
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY } = viteEnv;
const isBuild = command === "build";
return {
plugins: getPluginsList(viteEnv, isBuild),
base: VITE_PUBLIC_PATH,
root,
resolve: {
alias
},
// 服务端渲染
server: {
https: true,
host: "0.0.0.0",
port: VITE_PORT,
proxy: createProxy(VITE_PROXY)
},
// 设置全局scss变量
// css: {
// preprocessorOptions: {
// scss: {
// additionalData: `@import "@/style/var/index.scss";`
// }
// }
// },
optimizeDeps: {
include: [
"element-plus/es",
"element-plus/es/components/message/style/css",
"element-plus/es/components/notification/style/css",
"element-plus/es/components/message-box/style/css",
"pinia",
"vue-i18n",
"lodash-es",
"@vueuse/core"
],
exclude: ["@zougt/vite-plugin-theme-preprocessor/dist/browser-utils"]
},
build: {
sourcemap: false,
brotliSize: false,
chunkSizeWarningLimit: 4000
}
};
};