-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathwxt.config.ts
More file actions
73 lines (71 loc) · 1.94 KB
/
Copy pathwxt.config.ts
File metadata and controls
73 lines (71 loc) · 1.94 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { defineConfig } from 'wxt';
import removeConsole from 'vite-plugin-remove-console';
import tailwindcss from '@tailwindcss/vite';
import { readFileSync } from 'fs';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
// 从 package.json 读取版本号
const packageJson = JSON.parse(
readFileSync(resolve('./package.json'), 'utf-8'),
);
const version = packageJson.version;
// See https://wxt.dev/api/config.html
export default defineConfig({
modules: ['@wxt-dev/module-vue'],
manifest: {
name: '浸入式学语言助手(illa-helper)',
author: {
email: 'xiao1932794922@gmail.com',
},
description: `浸入式学语言助手(illa-helper) extension turns browsing into language learning. AI uses "i+1" theory, supports 20+ languages.`,
version,
permissions: [
'storage',
'notifications',
'contextMenus',
'activeTab',
'webNavigation',
],
host_permissions: ['<all_urls>', 'https://api.github.com/*'],
commands: {
'translate-page': {
suggested_key: {
default: 'Alt+Z',
mac: 'Command+Z',
},
description: '一键翻译',
},
},
},
imports: {
eslintrc: {
enabled: 9,
},
},
vite: (configEnv) => ({
plugins: [
tailwindcss(),
VueI18nPlugin({
// 自动加载语言包文件
include: [
resolve(
dirname(fileURLToPath(import.meta.url)),
'./src/i18n/locales/**',
),
],
// 支持 JSON 和 YAML 格式
forceStringify: true,
// 启用运行时优化
runtimeOnly: false,
// 自动生成类型定义
compositionOnly: true,
// 支持嵌套结构
fullInstall: true,
}),
configEnv.mode === 'production'
? [removeConsole({ includes: ['log', 'warn'] })]
: [],
],
}),
});