-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwxt.config.ts
More file actions
69 lines (63 loc) · 2 KB
/
Copy pathwxt.config.ts
File metadata and controls
69 lines (63 loc) · 2 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
import { defineConfig } from "wxt";
import { EventEmitter } from "events";
import { fileURLToPath } from "node:url";
import { resolveInlineDevMatches } from "./scripts/inline-dev-matches.mjs";
// Fix EventEmitter maxListeners warning
EventEmitter.defaultMaxListeners = 15;
const ALL_URLS = ["<all_urls>"];
export default defineConfig({
modules: ["@wxt-dev/module-react", "@wxt-dev/auto-icons"],
vite: () => ({
define: {
"process.emit": "(() => {})",
"process.env": "{}",
},
resolve: {
alias: {
src: fileURLToPath(new URL("./src", import.meta.url)),
},
},
}),
/** Resolves mode-specific env matches for both host permissions and injection. */
manifest: ({ mode }) => {
const developmentMatches = resolveInlineDevMatches(mode);
return {
name: "__MSG_extensionName__",
description: "__MSG_extensionDescription__",
default_locale: "en",
action: {
default_title: "__MSG_extensionName__",
},
permissions: ["storage", "clipboardWrite", "contextMenus"],
host_permissions:
mode === "development" ? developmentMatches : ALL_URLS,
browser_specific_settings: {
gecko: {
id: "{c9d7bdb4-9d7e-4a25-8b4a-0a8d51f3b8b1}",
// @ts-ignore - WXT doesn't support this field yet
data_collection_permissions: {
required: ["none"],
},
},
},
};
},
hooks: {
"entrypoints:resolved": (wxt, entrypoints) => {
const inlineContentScript = entrypoints.find(
(entrypoint) =>
entrypoint.type === "content-script" && entrypoint.name === "content",
);
if (inlineContentScript?.type !== "content-script") {
throw new Error("Inline content script entrypoint was not resolved.");
}
inlineContentScript.options.matches =
wxt.config.mode === "development"
? resolveInlineDevMatches(wxt.config.mode)
: [...ALL_URLS];
},
},
autoIcons: {
developmentIndicator: "overlay",
},
});