Files
u-ppt/vite.config.ts
T

25 lines
865 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig(({ mode }) => ({
plugins: [vue()],
build: {
chunkSizeWarningLimit: 800,
},
// npm run dev:webmode=web)→ 浏览器模式,端口 8080
// npm run tauri:dev → 默认 mode,端口 5173
server: mode === 'web'
? {
host: '127.0.0.1', port: 8080, open: true,
// 与 tauri dev 共存时防止 watch Cargo 产物(EBUSY 崩 watcher
watch: { ignored: ['**/src-tauri/target/**'] },
}
: {
host: '127.0.0.1', port: 5173, strictPort: true,
// 不 watch src-tauri/targetCargo 编译期间写 dll 会触发 EBUSY 崩掉 watcher
watch: { ignored: ['**/src-tauri/target/**'] },
},
// 桌面模式 HMR 由 tauri-cli 管理,无需自动打开浏览器
clearScreen: false,
}))