32 lines
981 B
TypeScript
32 lines
981 B
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
// link 进来的 @g3soft/ui 会带自己的 vue 副本,不去重会导致响应式失效
|
|
// (组件内 ref 变化不触发外部渲染)——link 方案最经典的坑。
|
|
dedupe: ['vue', 'vue-router', 'pinia'],
|
|
},
|
|
server: {
|
|
host: true,
|
|
port: 5090,
|
|
strictPort: true,
|
|
watch: {
|
|
// 忽略工具原子写入产生的临时文件(形如 .xxx.tmpdir\xxx.tmp),
|
|
// 避免 Windows 下 fs.watch 对瞬时存在的临时路径抛 EBUSY 导致 dev server 崩溃
|
|
ignored: [/[\\/]\.tmpdir[\\/]/, /\.tmp$/],
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: process.env.VITE_PROXY_TARGET || 'http://127.0.0.1:8088',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
plugins: [vue()],
|
|
})
|