-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
44 lines (41 loc) · 1.12 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
import { ConfigEnv, defineConfig, loadEnv } from 'vite';
import pkg from './package.json';
import { resolve } from 'path';
import dayjs from 'dayjs';
import { setupVitePlugins } from './vite';
import postcssPresetEnv from 'postcss-preset-env';
const { dependencies, devDependencies, name, version } = pkg;
const __APP_INFO__ = {
pkg: { dependencies, devDependencies, name, version },
lastBuildTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
};
export default defineConfig((configEnv: ConfigEnv) => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as ImportMetaEnv;
return {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
host: '0.0.0.0',
port: 8080,
open: true,
proxy: {
'/ndr': {
target: 'https://10.1.100.140',
changeOrigin: true, //是否跨域
secure: false
}
}
},
css: {
postcss: {
plugins: [postcssPresetEnv()]
}
},
plugins: setupVitePlugins(viteEnv),
define: { __APP_INFO__: JSON.stringify(__APP_INFO__) }
};
});