-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathwxt.config.ts
More file actions
77 lines (69 loc) · 2.31 KB
/
Copy pathwxt.config.ts
File metadata and controls
77 lines (69 loc) · 2.31 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
import { defineConfig } from "wxt";
// See https://wxt.dev/api/config.html
import os from "node:os";
import path from "node:path";
const _profilePath = path.join(os.homedir(), ".chrome-extension-dev-profile");
export default defineConfig({
modules: ["@wxt-dev/module-react"],
// webExt: {
// chromiumProfile: _profilePath,
// keepProfileChanges: true,
// },
// Ensure UTF-8 encoding and strip invalid Unicode for Chrome extension compatibility
hooks: {
"build:done": async (wxt) => {
const fs = await import("fs");
const path = await import("path");
const outDir = wxt.config.outDir;
function fixEncoding(dir: string) {
if (!fs.existsSync(dir)) return;
for (const file of fs.readdirSync(dir)) {
const fullPath = path.join(dir, file);
if (fs.statSync(fullPath).isDirectory()) {
fixEncoding(fullPath);
} else if (/\.(js|json|html|css)$/.test(file)) {
let content = fs.readFileSync(fullPath, "utf8");
// Remove Unicode noncharacters (U+FFFE, U+FFFF) that Chrome rejects
content = content.replace(/[\uFFFE\uFFFF]/g, "");
fs.writeFileSync(fullPath, content, "utf8");
}
}
}
fixEncoding(outDir);
},
},
manifest: {
name: "Degree Audit + by LHD",
description:
"Created by Longhorn Developers (LHD) to enhance the degree planning experience for students at the University of Texas at Austin.",
version: "1.0.0",
action: { default_popup: "popup-app.html" },
icons: {
"16": "icon/LHD Logo.png",
"32": "icon/LHD Logo.png",
"48": "icon/LHD Logo.png",
"128": "icon/LHD Logo.png",
"256": "icon/LHD Logo.png",
},
permissions: ["storage", "tabs", "scripting", "windows", "cookies"],
host_permissions: ["https://utdirect.utexas.edu/*"],
optional_host_permissions: [],
optional_permissions: [],
web_accessible_resources: [
{
resources: ["Grid.png"],
matches: ["https://utdirect.utexas.edu/*"],
},
],
},
vite: () =>
import("@tailwindcss/postcss").then((tailwindcss) =>
import("autoprefixer").then((autoprefixer) => ({
css: {
postcss: {
plugins: [tailwindcss.default, autoprefixer.default],
},
},
})),
),
});