forked from TanShilongMario/PromptFill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
28 lines (26 loc) · 975 Bytes
/
Copy pathvite.config.js
File metadata and controls
28 lines (26 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
// 防止 Vite 默认清除控制台,方便调试
clearScreen: false,
// 让 Tauri 能够监听特定的端口
server: {
port: 1420,
strictPort: true,
host: true, // 保持原本的 --host 功能
},
// 设置环境变量的前缀,这样在 Tauri 中可以访问它们
envPrefix: ['VITE_', 'TAURI_'],
build: {
// 只有在 Tauri 构建时才应用特殊的 target
target: process.env.TAURI_PLATFORM
? (process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13')
: 'modules', // 网页版使用标准的现代化模块 target
// 在非调试构建中不缩小代码,方便报错定位(可选)
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
// 为调试构建生成源代码映射
sourcemap: !!process.env.TAURI_DEBUG,
},
})