-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathwxt.config.ts
More file actions
65 lines (62 loc) · 2.61 KB
/
wxt.config.ts
File metadata and controls
65 lines (62 loc) · 2.61 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
import { defineConfig } from 'wxt';
import pkg from './package.json';
import { resolve } from 'path';
// See https://wxt.dev/api/config.html
export default defineConfig({
// https://wxt.dev/guide/resources/upgrading.html#default-output-directories-changed
outDirTemplate: '{{browser}}-mv{{manifestVersion}}',
vite: () => ({
resolve: {
alias: {
'@': resolve(__dirname, '.'),
'vue-i18n': 'vue-i18n/dist/vue-i18n.esm-bundler.js',
},
},
define: {
// 将环境变量注入到浏览器扩展中
'import.meta.env.VITE_TELEGRAM_ENABLED': JSON.stringify(process.env.VITE_TELEGRAM_ENABLED || 'false'),
'import.meta.env.VITE_TELEGRAM_BOT_TOKEN': JSON.stringify(process.env.VITE_TELEGRAM_BOT_TOKEN || ''),
'import.meta.env.VITE_TELEGRAM_CHANNEL_ID': JSON.stringify(process.env.VITE_TELEGRAM_CHANNEL_ID || ''),
'import.meta.env.VITE_DISCORD_ENABLED': JSON.stringify(process.env.VITE_DISCORD_ENABLED || 'false'),
'import.meta.env.VITE_DISCORD_WEBHOOK_URL': JSON.stringify(process.env.VITE_DISCORD_WEBHOOK_URL || ''),
'import.meta.env.VITE_NOTION_ENABLED': JSON.stringify(process.env.VITE_NOTION_ENABLED || 'false'),
'import.meta.env.VITE_NOTION_INTEGRATION_TOKEN': JSON.stringify(process.env.VITE_NOTION_INTEGRATION_TOKEN || ''),
'import.meta.env.VITE_NOTION_DATABASE_ID': JSON.stringify(process.env.VITE_NOTION_DATABASE_ID || ''),
'import.meta.env.PACKAGE_VERSION': JSON.stringify(pkg.version),
// vue-i18n 特性标志
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
__INTLIFY_JIT_COMPILATION__: true,
},
esbuild: {
// 生产环境移除 console 和 debugger
drop: process.env.NODE_ENV === 'production' ? ['console', 'debugger'] : [],
},
}),
modules: ['@wxt-dev/module-vue'],
manifest: {
name: 'Clipper Hub - 万能剪藏',
version: pkg.version,
description:
'将网页内容一键收藏至多个平台的浏览器扩展,支持 Telegram、Discord、Notion 等多个平台,让你的灵感和收藏无处不在。',
permissions: ['contextMenus', 'storage', 'notifications', 'scripting', 'activeTab'],
host_permissions: [
'https://api.telegram.org/*',
'https://discord.com/api/webhooks/*',
'https://discordapp.com/api/webhooks/*',
'https://api.notion.com/*',
],
browser_specific_settings: {
gecko: {
// @ts-ignore - data_collection_permissions 是 Firefox 要求的新属性
data_collection_permissions: {
required: [
'browsingActivity', // 需要访问网页内容和选中的文本
'websiteContent', // 需要读取和处理网页内容
],
},
} as any,
},
} as any,
});