Files
sub2api/frontend/vite.config.ts

45 lines
1.0 KiB
TypeScript
Raw Normal View History

2025-12-18 13:50:39 +08:00
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
2025-12-18 14:26:55 +08:00
import checker from 'vite-plugin-checker'
2025-12-18 13:50:39 +08:00
import { resolve } from 'path'
export default defineConfig({
2025-12-18 14:26:55 +08:00
plugins: [
vue(),
checker({
typescript: true,
vueTsc: true
})
2025-12-18 14:26:55 +08:00
],
2025-12-18 13:50:39 +08:00
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
// 使用 vue-i18n 运行时版本,避免 CSP unsafe-eval 问题
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
}
2025-12-18 13:50:39 +08:00
},
define: {
// 启用 vue-i18n JIT 编译,在 CSP 环境下处理消息插值
// JIT 编译器生成 AST 对象而非 JS 代码,无需 unsafe-eval
__INTLIFY_JIT_COMPILATION__: true
},
2025-12-18 13:50:39 +08:00
build: {
outDir: '../backend/internal/web/dist',
emptyOutDir: true
2025-12-18 13:50:39 +08:00
},
server: {
host: '0.0.0.0',
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true
2025-12-18 13:50:39 +08:00
},
'/setup': {
target: 'http://localhost:8080',
changeOrigin: true
}
}
}
2025-12-18 13:50:39 +08:00
})