-
Notifications
You must be signed in to change notification settings - Fork 2
/
wxt.config.ts
70 lines (59 loc) · 1.47 KB
/
wxt.config.ts
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
import type { UserManifest } from 'wxt'
import { defineConfig } from 'wxt'
import { GITHUB_URL } from './src/constants'
import { uid } from './src/utils/uid'
import { name, displayName, version, description } from './package.json'
const EXT_BUILD_ID = JSON.stringify(uid())
const EXT_USER_AGENT = JSON.stringify(`${displayName}/${version}`)
export default defineConfig({
manifestVersion: 3,
manifest: ({ browser }) => {
const permissions: UserManifest['permissions'] = [
'storage',
'unlimitedStorage',
'tabs',
'contextMenus',
'clipboardWrite',
'clipboardRead',
'downloads',
]
let browser_specific_settings: UserManifest['browser_specific_settings']
switch (browser) {
case 'chrome':
permissions.push('sidePanel')
break
case 'firefox':
browser_specific_settings = {
gecko: {
id: `${name}@midra.me`,
strict_min_version: '113.0',
},
}
break
}
return {
name: displayName,
description,
homepage_url: GITHUB_URL,
permissions,
host_permissions: ['<all_urls>'],
browser_specific_settings,
}
},
srcDir: 'src',
outDir: 'dist',
imports: false,
vite: () => ({
define: {
EXT_BUILD_ID,
EXT_USER_AGENT,
},
build: {
chunkSizeWarningLimit: 1024,
},
ssr: {
noExternal: ['@webext-core/messaging'],
},
}),
modules: ['@wxt-dev/module-react'],
})