Files
testing-tool/wxt.config.ts
LingandRX a5d86a92c2 develop (#67)
feat: 升级项目 Logo、完善 toast 提示及优化工程化配置

### Features
- **logo**: 替换全套项目图标,更新 wxt.config.ts 浏览器扩展图标配置。

### Bug Fixes
- **ui/toast**: 引入 <Toaster> 组件修复 toast 无法显示问题,并调整位置为正下方。
- **i18n**: 统一将 t() 函数中的 `.` 和 `:` 转换为 `_`,修复国际化文案读取失败问题。
- **context-menu**: 限制 srcUrl 检查仅在二维码图片菜单项生效,避免误判。
- **hooks**: 修复 pre-push 钩子,仅对变更文件进行 eslint 检查,并支持无 upstream 时的回退对比。
- **components**: 修复 CopyButton 动画与组件导入方式,并补齐无障碍属性与测试。
- **async**: 延迟生成二维码以正确渲染 loading 状态,并适配相关异步测试。

### Refactor & Cleans
- **clean**: 清理未使用的组件(ToolCard)、Hook(useDebounce)及多个未使用的工具函数导出。
- **structure**: 统一移动测试文件至 __tests__ 目录,移除不必要的类型导出。

### Documentation
- **docs**: 在 AGENTS.md 中明确规范 Git Commit 必须使用中文描述。
2026-06-06 01:07:27 +08:00

91 lines
2.1 KiB
TypeScript

import { defineConfig } from 'wxt';
import type { Plugin } from 'vite';
function manualChunksForHtmlOnly(): Plugin {
return {
name: 'manual-chunks-html-only',
outputOptions(rawOptions) {
if (rawOptions.format === 'iife' || rawOptions.format === 'umd') {
return;
}
return {
...rawOptions,
manualChunks(id: string): string | void {
if (!id.includes('node_modules')) {
return undefined;
}
if (
id.includes('/react-dom/') ||
(id.includes('/react/') && !id.includes('/react-dom/'))
) {
return 'vendor-react';
}
// 二维码活态感知依赖分流
if (id.includes('qr-scanner') || id.includes('qrious')) {
return 'vendor-qr';
}
// 拖拽排序高级组件分流
if (id.includes('@dnd-kit')) {
return 'vendor-dnd';
}
return undefined;
},
};
},
};
}
export default defineConfig({
modules: ['@wxt-dev/module-react'],
srcDir: 'src',
manifest: {
name: 'Testing Tool',
description: 'A tool for testing web applications.',
version_name: undefined,
default_locale: 'zh_CN',
permissions: [
'storage',
'unlimitedStorage',
'clipboardWrite',
'activeTab',
'scripting',
'tabs',
'cookies',
'sidePanel',
'contextMenus',
],
host_permissions: ['<all_urls>'],
icons: {
'16': 'icon/16.png',
'32': 'icon/32.png',
'48': 'icon/48.png',
'96': 'icon/96.png',
'128': 'icon/128.png',
},
action: {
default_title: '__MSG_appName__',
default_icon: {
'16': 'icon/16.png',
'32': 'icon/32.png',
'48': 'icon/48.png',
},
},
side_panel: {
default_path: 'entrypoints/sidepanel/index.html',
},
},
vite: () => ({
plugins: [manualChunksForHtmlOnly()],
build: {
minify: 'terser',
terserOptions: {
format: { ascii_only: true, comments: false },
},
chunkSizeWarningLimit: 800,
},
}),
});