-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwxt.config.ts
88 lines (84 loc) · 2.41 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { defineConfig } from "wxt";
import type { UserConfig } from "wxt";
import { YOUTUBE_MATCHES } from "./src/utils/constants.js";
import viteConfig from "./vite.config.js";
export const developConfig: UserConfig = {
srcDir: "src",
entrypointsDir: "entrypoints", // src/entrypoints
publicDir: "public", // src/public,
modulesDir: "wxtModules",
outDirTemplate: "{{browser}}-mv{{manifestVersion}}-{{mode}}",
runner: {
disabled: false,
binaries: {
arc: "/Applications/Arc.app/Contents/MacOS/Arc",
edge: "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
firefox: "firefoxdeveloperedition",
},
openConsole: true,
},
// debug: true,
vite: (configEnv) => viteConfig(configEnv),
};
/**
* @description manifest.json config
* @returns Some explicit configuration of manifest.json
*/
export const manifestJsonConfig: UserConfig["manifest"] = (configEnv) => ({
name: "__MSG_appName__",
short_name: "__MSG_appShortName__",
description: "__MSG_appDescription__",
// NOTE: auto generate by package.json semver
// version: "4.0.0",
// NOTE: Firefox is still mv2, so not explicitly. https://wxt.dev/guide/multiple-browsers.html#target-manifest-version
// manifest_version: 3,
default_locale: "en",
icons: {
"16": "/images/icon-16.png",
"32": "/images/icon-32.png",
"48": "/images/icon-48.png",
"128": "/images/icon-128.png",
},
action: {
default_icon: {
"16": "/images/icon-16.png",
"32": "/images/icon-32.png",
"48": "/images/icon-48.png",
"128": "/images/icon-128.png",
},
default_title: "__MSG_browserActionTitle__",
},
permissions: ["storage", "tabs"],
web_accessible_resources: [
{
resources: ["youtube-mainworld.js"],
matches: YOUTUBE_MATCHES,
},
],
// NOTE: must need id for use storage API etc, https://extensionworkshop.com/documentation/develop/extensions-and-the-add-on-id/
browser_specific_settings:
configEnv.browser === "firefox"
? {
gecko: {
id: "{6c3b7240-7017-430b-b03c-432e61ee3a82}",
strict_min_version: "58.0",
},
}
: undefined,
});
// polymer config
export const createWxtConfig = ({
developConfig,
manifestConfig = manifestJsonConfig,
}: {
developConfig: UserConfig;
manifestConfig?: UserConfig["manifest"];
}) => {
const config: UserConfig = {
...developConfig,
manifest: manifestConfig,
};
return defineConfig(config);
};
// See https://wxt.dev/api/config.html
export default createWxtConfig({ developConfig });