forked from oppplll/weread-scraper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
64 lines (63 loc) · 1.77 KB
/
vite.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
import { defineConfig } from "vite";
import monkey, { cdn } from "vite-plugin-monkey";
import { packages } from "./package-lock.json";
// https://vitejs.dev/config/
export default defineConfig({
publicDir: false,
plugins: [
monkey({
entry: "src/main.ts",
userscript: {
name: "WeRead Scraper",
icon: "https://weread.qq.com/favicon.ico",
namespace: "https://github.com/Sec-ant/weread-scraper",
match: [
"https://weread.qq.com/web/reader/*",
"https://weread.qq.com/web/book/read*",
],
grant: [
"GM_registerMenuCommand",
"GM_unregisterMenuCommand",
"GM_getValue",
"GM_setValue",
"GM_deleteValue",
"GM_webRequest",
"GM_xmlhttpRequest",
"unsafeWindow",
],
connect: [
"fastly.jsdelivr.net",
"weread.qq.com",
"tencent-cloud.com",
"*",
],
"run-at": "document-start",
},
build: {
externalGlobals: {
"minify-html-wasm": cdn.jsdelivrFastly(
"wasm_bindgen",
"dist/no-modules/index.min.js"
),
"zustand/vanilla": cdn.jsdelivrFastly(
"zustandVanilla",
"umd/vanilla.production.js"
),
"zustand/middleware": cdn.jsdelivrFastly(
"zustandMiddleware",
"umd/middleware.production.js"
),
"@sec-ant/gm-fetch": cdn.jsdelivrFastly(
"gmFetch",
"dist/index.iife.js"
),
},
},
}),
],
define: {
__WASM_URL__: JSON.stringify(
`https://fastly.jsdelivr.net/npm/minify-html-wasm@${packages["node_modules/minify-html-wasm"].version}/dist/no-modules/index_bg.wasm`
),
},
});