chore: 容器框架升级,修复项目命令行异常问题
This commit is contained in:
46
apps/platform/vite.config.mts
Normal file
46
apps/platform/vite.config.mts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { defineConfig } from '@vben/vite-config';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import ElementPlus from 'unplugin-element-plus/vite';
|
||||
import { loadEnv } from 'vite';
|
||||
import mkcert from 'vite-plugin-mkcert';
|
||||
|
||||
import pkg from './package.json';
|
||||
|
||||
const __APP_INFO__ = {
|
||||
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
pkg,
|
||||
};
|
||||
|
||||
export default defineConfig(async ({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
return {
|
||||
application: {},
|
||||
define: {
|
||||
// 注入环境变量到客户端
|
||||
__APP_ENV__: JSON.stringify(env),
|
||||
__APP_INFO__: JSON.stringify(__APP_INFO__),
|
||||
},
|
||||
vite: {
|
||||
plugins: [
|
||||
mkcert(),
|
||||
ElementPlus({
|
||||
format: 'esm',
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
http2: true,
|
||||
https: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
target: 'http://localhost:5320/api',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user