-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwxt.config.ts
More file actions
87 lines (85 loc) · 2.63 KB
/
Copy pathwxt.config.ts
File metadata and controls
87 lines (85 loc) · 2.63 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { defineConfig } from "wxt";
const iconPaths = {
"16": "images/icon-16.png",
"19": "images/icon-19.png",
"24": "images/icon-24.png",
"32": "images/icon-32.png",
"38": "images/icon-38.png",
"48": "images/icon-48.png",
"64": "images/icon-64.png",
"96": "images/icon-96.png",
"128": "images/icon-128.png",
};
export default defineConfig({
srcDir: "app",
modules: ["@wxt-dev/module-react", "@wxt-dev/webextension-polyfill"],
manifest: ({ browser, manifestVersion }) => ({
name: "__MSG_ExtensionName__",
short_name: "__MSG_ExtensionShortName__",
description: "__MSG_ExtensionDescription__",
default_locale: "en",
homepage_url: "https://rthaut.github.io/deviantART-Filter",
icons: iconPaths,
// MV3 has no page_action; the action button is emulated as a page action
// at runtime (disabled globally, enabled per-tab on deviantart.com)
[manifestVersion === 3 ? "action" : "page_action"]: {
default_icon: iconPaths,
default_title: "__MSG_BrowserActionTitle__",
},
permissions: [
"activeTab",
"contextMenus",
"notifications",
"storage",
"tabs",
// MV3 moves host match patterns into host_permissions
...(manifestVersion === 3 ? [] : ["*://*.deviantart.com/*"]),
],
...(manifestVersion === 3
? { host_permissions: ["*://*.deviantart.com/*"] }
: {}),
web_accessible_resources:
manifestVersion === 3
? [
{
resources: ["create-filters.html"],
matches: ["*://*.deviantart.com/*"],
},
]
: ["create-filters.html"],
...(browser === "firefox"
? {
browser_specific_settings: {
gecko: {
id: "{a2ce7c11-e47d-42cf-b6db-ede36265cf6c}",
strict_min_version: "62.0",
data_collection_permissions: {
required: ["none"],
},
},
},
}
: {
// MV3 requires Chrome 88+ (Edge 88+ is the matching Chromium)
minimum_chrome_version:
manifestVersion === 3
? "88.0"
: browser === "edge"
? "79.0"
: "49.0",
}),
}),
vite: ({ browser }) => ({
build: {
// Vite ignores browserslist; set the transpilation target explicitly so
// built bundles honor each browser's minimum supported version (without
// this, `?.`/`??`/`??=` are emitted untranspiled and break Firefox 62)
target: browser === "firefox" ? "firefox62" : "chrome88",
},
resolve: {
alias: {
scripts: "/app/scripts",
},
},
}),
});