-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
36 lines (34 loc) · 889 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
import type { ConfigEnv, UserConfig } from 'vite';
import { loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'node:path';
const envPrefix = ['VITE_'];
// https://vitejs.dev/config/
export default async ({ mode }: ConfigEnv): Promise<UserConfig> => {
const packageRoot = process.cwd();
const { VITE_PUBLIC_PATH } = loadEnv(mode, packageRoot, envPrefix);
return {
base: VITE_PUBLIC_PATH,
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 5177,
strictPort: true,
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${path.resolve('src/styles/variables.less')}";`,
},
math: 'strict',
javascriptEnabled: true,
},
},
},
plugins: [vue()],
};
};