Files
cutThink_lite/vite.config.js
Claude e2ea309ee6 feat: CutThenThink v3.0 初始版本
完整实现 Tauri + Vanilla JS 轻量级截图工具

Phase 1 - 项目搭建
- Tauri 2.x 项目初始化
- Vite 前端项目搭建
- 基础 UI 框架(CSS 变量、组件库)
- 构建配置优化

Phase 2 - 核心截图功能
- 全屏/区域/窗口截图
- 截图预览和管理
- 文件命名和缩略图
- 全局快捷键集成

Phase 3 - 上传与存储
- 多图床上传(GitHub/Imgur/自定义)
- 配置管理系统
- SQLite 数据库

Phase 4 - OCR 集成
- 云端 OCR(百度/腾讯云)
- 插件管理系统
- 本地 OCR 插件(Go)
- OCR 结果处理

Phase 5 - AI 分类系统
- Claude/OpenAI API 集成
- Prompt 模板引擎
- 模板管理界面
- 自动分类流程

Phase 6 - 历史记录与管理
- 图库视图(网格/列表)
- 搜索与筛选
- 批量操作
- 导出功能(JSON/CSV/ZIP)

Phase 7 - 打包与发布
- 多平台构建配置
- CI/CD 工作流
- 图标和资源
- 安装包配置

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:59:26 +08:00

101 lines
2.4 KiB
JavaScript
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'
// Vite 配置文件 - 优化生产环境构建
export default defineConfig(({ mode }) => {
const isProduction = mode === 'production'
return {
// 开发服务器配置
server: {
port: 5173,
strictPort: true,
watch: {
// 监听文件变化
ignored: ['**/src-tauri/**'],
},
},
// 构建配置
build: {
// Tauri 使用 Chrome WebView可以设置更高的 target
target: 'es2020',
// 输出目录
outDir: './dist',
// 生产环境不生成 source map减小体积
sourcemap: !isProduction,
// 代码分割配置
rollupOptions: {
output: {
// 手动代码分割
manualChunks: {
// 将 Tauri API 单独分割
'tauri-api': ['@tauri-apps/api'],
},
// 资源文件命名
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: (assetInfo) => {
const name = assetInfo.name || ''
if (name.endsWith('.css')) {
return 'assets/css/[name]-[hash][extname]'
}
if (/\.(png|jpe?g|gif|svg|webp|ico)$/.test(name)) {
return 'assets/images/[name]-[hash][extname]'
}
return 'assets/[name]-[hash][extname]'
},
},
},
// 压缩配置
minify: 'terser',
terserOptions: {
compress: {
// 删除 console
drop_console: isProduction,
// 删除 debugger
drop_debugger: isProduction,
// 移除无用代码
pure_funcs: isProduction ? ['console.log', 'console.info'] : [],
},
format: {
// 移除注释
comments: false,
},
},
// 设置 chunk 大小警告阈值KB
chunkSizeWarningLimit: 500,
// CSS 代码分割
cssCodeSplit: true,
// CSS 压缩
cssMinify: true,
},
// 依赖优化
optimizeDeps: {
include: ['@tauri-apps/api'],
},
// 路径配置 - 相对路径以支持 Tauri
base: './',
// 开发时不清屏,方便看到错误信息
clearScreen: false,
// 生产环境优化
...(isProduction && {
// 关闭一些开发时的功能
esbuild: {
// 移除 console.log
drop: isProduction ? ['console', 'debugger'] : [],
},
}),
}
})