forked from latestchatty/chromeshack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwxt.config.ts
69 lines (63 loc) · 1.82 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
import { preact } from "@preact/preset-vite";
import { description, version } from "./package.json";
import { defineConfig } from "wxt";
// See https://wxt.dev/api/config.html
export default defineConfig({
extensionApi: "chrome",
outDir: "dist",
vite: () => ({
plugins: [preact()],
}),
manifest: ({ browser, manifestVersion }) => {
const baseConfig = {
name: "Chrome Shack",
version,
description,
icons: {
"16": "images/icon16.png",
"48": "images/icon48.png",
"96": "images/icon96.png",
"128": "images/icon-chrome-web-store.png",
"144": "images/icon144.png",
},
action: {
default_icon: "images/icon16.png",
default_title: "Chrome Shack",
},
permissions: ["tabs", "storage", "notifications", "alarms"],
};
const firefoxMixin = {
browser_specific_settings: {
gecko: {
id: "{33a5e61a-ec1e-4761-9515-e7ab23a8b679}",
strict_min_version: "109.0",
},
},
options_ui: {
page: "permissions.html",
},
permissions: [...baseConfig.permissions, "scripting"],
};
const v2Mixin = {
permissions: [
"activeTab",
"https://api.imgur.com/3/*",
"https://api.gfycat.com/v1/gfycats/*",
"https://filedrop.gfycat.com/*",
"https://*.youtube.com/embed/*",
"https://api.streamable.com/videos/*",
"https://*.shacknews.com/chatty*",
],
};
let outputConfig: any = {};
if (browser === "firefox") {
outputConfig = { ...baseConfig, ...firefoxMixin };
} else {
outputConfig = { ...baseConfig };
}
if (manifestVersion === 2) {
outputConfig = { ...outputConfig, permissions: [...outputConfig.permissions, ...v2Mixin.permissions] };
}
return outputConfig;
},
});