-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
37 lines (36 loc) · 1.02 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
import { defineConfig, ConfigEnv, UserConfig, loadEnv } from 'vite'
import { resolve } from 'path'
import { createVitePlugins } from './build/plugins'
import { wrapperEnv } from './build/getEnv'
import { createProxy } from "./build/proxy";
// https://vitejs.dev/config/
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const root = process.cwd();
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
return {
resolve: {
// 配置src路径别名为 “@”
alias: {
"@": resolve(__dirname, "./src"),
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js"
}
},
plugins: createVitePlugins(viteEnv),
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/styles/var.scss";`
}
}
},
server: {
host: "0.0.0.0",
port: viteEnv.VITE_PORT,
open: viteEnv.VITE_OPEN,
cors: true,
// Load proxy configuration from .env.development
proxy: createProxy(viteEnv.VITE_PROXY)
}
}
});