-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwxt.config.ts
More file actions
71 lines (69 loc) · 1.93 KB
/
wxt.config.ts
File metadata and controls
71 lines (69 loc) · 1.93 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
import { defineConfig } from "wxt"
export default defineConfig({
srcDir: "src",
modules: ["@wxt-dev/module-react"],
manifest: ({ browser }) => {
const requestableOrigins = ["https://*/*", "http://*/*"]
return {
name: "__MSG_extName__",
description: "__MSG_extDescription__",
default_locale: "en",
host_permissions: [
...new Set([
`${import.meta.env.WXT_SOCKET_ENDPOINT || "http://localhost:3001"}/*`,
"http://localhost:3001/*",
`${import.meta.env.WXT_PUBLIC_POSTHOG_HOST || "https://eu.i.posthog.com"}/*`
])
],
optional_host_permissions:
browser === "firefox" ? undefined : requestableOrigins,
optional_permissions:
browser === "firefox"
? ["activeTab", ...requestableOrigins]
: ["activeTab"],
permissions: ["storage", "activeTab", "scripting"],
content_security_policy: {
extension_pages: [
"script-src 'self';",
"object-src 'self';",
`connect-src 'self' https://*.posthog.com https://eu.i.posthog.com http://localhost:3000 http://localhost:3001 ws://localhost:3000 ws://localhost:3001 ${import.meta.env.WXT_SOCKET_ENDPOINT || ""};`
]
.join(" ")
.replace(/\s+/g, " ")
.trim()
},
browser_specific_settings: {
gecko: {
id: "{eb8f96ca-d31a-4f74-89ad-c25045497adb}"
}
},
icons: {
128:
browser === "firefox"
? "/extension-icon-firefox.png"
: "/extension-icon.png"
},
web_accessible_resources: [
{
resources: ["injected.js"],
matches: ["<all_urls>"]
}
]
}
},
imports: false,
vite: () => ({
resolve: {
alias: {
react: "preact/compat",
"react-dom": "preact/compat"
}
},
build: {
target: "esnext"
},
esbuild: {
charset: "ascii"
}
})
})