Files
urbanLifeline/urbanLifelineWeb/packages/bidding/vite.config.ts

68 lines
1.4 KiB
TypeScript
Raw Normal View History

2025-12-06 14:49:46 +08:00
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { resolve, dirname } from 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
2025-12-13 14:13:31 +08:00
export default defineConfig(({ mode }) => ({
// 开发和生产环境都通过nginx代理访问/bidding
base: '/bidding/',
2025-12-11 14:21:36 +08:00
plugins: [
vue({
script: {
defineModel: true,
propsDestructure: true
}
}),
vueJsx()
],
define: {
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: true,
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: true
},
2025-12-06 14:49:46 +08:00
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
2025-12-15 14:50:29 +08:00
port: 7002,
2025-12-06 14:49:46 +08:00
host: true,
cors: true,
2025-12-13 14:13:31 +08:00
open: '/bidding/', // 开发时自动打开到 /bidding/ 路径
2025-12-06 14:49:46 +08:00
proxy: {
'/api': {
2025-12-11 16:26:48 +08:00
target: 'http://localhost:8180',
2025-12-06 14:49:46 +08:00
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/api/, '')
},
// 代理共享模块请求到 shared 服务
'/shared': {
2025-12-15 14:50:29 +08:00
target: 'http://localhost:7000',
2025-12-06 14:49:46 +08:00
changeOrigin: true
}
}
},
build: {
outDir: 'dist',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
'vue-vendor': ['vue', 'vue-router', 'pinia'],
'element-plus': ['element-plus']
}
}
}
}
2025-12-13 14:13:31 +08:00
}))