chore: 统一各 app 的构建目录

This commit is contained in:
wangxuefeng
2025-03-03 18:22:24 +08:00
parent 7fb8f5b7f8
commit 7c6a86edf6
14 changed files with 102 additions and 180 deletions

View File

@@ -17,8 +17,6 @@ import type { UserConfig, ConfigEnv } from 'vite';
// console.log(DEV_SERVER_PORT);
const CWD = process.cwd();
const __APP_INFO__ = {
pkg,
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
@@ -27,12 +25,14 @@ const __APP_INFO__ = {
// https://vitejs.dev/config/
export default ({ command, mode }: ConfigEnv): UserConfig => {
// 环境变量
const { VITE_BASE_API_URL, VITE_BASE_URL, ENV } = loadEnv(mode, CWD);
const env = loadEnv(mode, process.cwd(), ['VITE_', 'VTJ_', 'SY_']);
const isDev = command === 'serve';
return {
define: {
__APP_INFO__: JSON.stringify(__APP_INFO__),
// 注入环境变量到客户端
__APP_ENV__: JSON.stringify(env),
},
resolve: {
alias: [
@@ -64,7 +64,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
Http2Proxy(),
createSvgIconsPlugin({
// Specify the icon folder to be cached
iconDirs: [resolve(CWD, 'src/assets/icons')],
iconDirs: [resolve(process.cwd(), 'src/assets/icons')],
// Specify symbolId format
symbolId: 'svg-icon-[dir]-[name]',
}),
@@ -119,7 +119,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
},
},
build: {
outDir: 'dist',
outDir: resolve(process.cwd(), '../../dist/platform'), // 输出到根目录/designer
emptyOutDir: true,
terserOptions: {
compress: {