-
Notifications
You must be signed in to change notification settings - Fork 347
Expand file tree
/
Copy pathvite.config.mts
More file actions
34 lines (33 loc) · 831 Bytes
/
vite.config.mts
File metadata and controls
34 lines (33 loc) · 831 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
30
31
32
33
34
import path from 'node:path';
import process from 'node:process';
import { defineConfig, loadEnv } from 'vite';
import plugins from './.build/plugins';
// https://vite.dev/config/
export default defineConfig((cnf) => {
const { mode } = cnf;
const env = loadEnv(mode, process.cwd());
const { VITE_APP_ENV } = env;
return {
base: VITE_APP_ENV === 'production' ? '/' : '/',
plugins: plugins(cnf),
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
css: {
// css全局变量使用,@/styles/variable.scss文件
preprocessorOptions: {
scss: {
additionalData: '@use "@/styles/var.scss" as *;',
},
},
},
// 浏览器缓存问题
server: {
headers: {
'Cache-Control': 'no-store',
},
},
};
});