Files
codex-proxy-rs/frontend/vite.config.ts
T
ZyyandCodex 3cc9c71ab5 feat(accounts): support custom platform icons
Store icon choices per account and display them across the admin views. Refine account form controls and simplify the API key setup dialog. Pin the UI library to v0.14.0.

Co-authored-by: Codex <noreply@openai.com>
2026-11-29 17:57:43 +08:00

74 lines
2.0 KiB
TypeScript

import { fileURLToPath, URL } from 'node:url'
import CodexProxyUI from '@codex-proxy/ui/vite'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
import tailwindcss from '@tailwindcss/vite'
import vue from '@vitejs/plugin-vue'
import { defineConfig, loadEnv } from 'vite'
import { consoleBanner } from './build/console-banner.ts'
import { platformIcons } from './build/platform-icons.ts'
import { pluginBridge } from './build/plugin-bridge.ts'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, fileURLToPath(new URL('.', import.meta.url)), 'CPR_WEB_BASE_PATH')
const sourceUi = mode === 'source'
const uiRoot = new URL('../modules/ui/', import.meta.url)
return {
base: env.CPR_WEB_BASE_PATH || '/',
plugins: [
vue(),
VueI18n({
include: fileURLToPath(new URL('./src/i18n/locales/**/*.json', import.meta.url)),
}),
tailwindcss(),
CodexProxyUI({
source: sourceUi ? uiRoot : undefined,
}),
platformIcons(),
pluginBridge(),
consoleBanner(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 5173,
proxy: {
'/dev': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
cookiePathRewrite: { '/api/auth': '/dev/api/auth' },
rewrite: path => path.replace(/^\/dev/, ''),
},
},
},
build: {
outDir: sourceUi ? 'node_modules/.vite/source-dist' : 'dist',
assetsDir: 'assets',
license: { fileName: 'THIRD_PARTY_LICENSES.md' },
chunkSizeWarningLimit: 600,
rolldownOptions: {
checks: {
invalidAnnotation: false,
},
output: {
codeSplitting: {
groups: [
{
name: 'echarts',
test: /node_modules\/echarts/,
},
{
name: 'zrender',
test: /node_modules\/zrender/,
},
],
},
},
},
},
}
})