0054e97a0a
- 删除 options 入口点目录及相关文件 - 移除 wxt.config.ts 中 options_ui 配置 - 移除 TopBar 组件中的设置按钮和 onOpenOptions prop - 移除 popup/sidepanel App.tsx 中的 handleOpenOptions - 移除相关测试中的设置页面引用 - 移除 messages.json 中设置相关翻译键 - 通过 lint、typecheck、test 验证
80 lines
1.8 KiB
TypeScript
80 lines
1.8 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',
|
|
permissions: [
|
|
'storage',
|
|
'unlimitedStorage',
|
|
'clipboardWrite',
|
|
'activeTab',
|
|
'scripting',
|
|
'tabs',
|
|
'cookies',
|
|
'sidePanel',
|
|
'contextMenus',
|
|
'alarms',
|
|
],
|
|
host_permissions: ['<all_urls>'],
|
|
action: {
|
|
default_title: '__MSG_appName__',
|
|
},
|
|
side_panel: {
|
|
default_path: 'entrypoints/sidepanel/index.html',
|
|
},
|
|
},
|
|
vite: () => ({
|
|
plugins: [manualChunksForHtmlOnly()],
|
|
build: {
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
format: { ascii_only: true, comments: false },
|
|
},
|
|
chunkSizeWarningLimit: 800,
|
|
},
|
|
}),
|
|
});
|