-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.chrome.config.js
More file actions
42 lines (41 loc) · 1.24 KB
/
Copy pathvite.chrome.config.js
File metadata and controls
42 lines (41 loc) · 1.24 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
import { defineConfig } from "vite";
import { resolve } from "node:path";
import projectConfig from "./config.json" with { type: "json" };
export default defineConfig({
base: "./",
define: {
__PROJECT_CONFIG__: JSON.stringify(projectConfig),
},
root: resolve("src/renderer"),
publicDir: resolve("public"),
plugins: [
{
name: "chrome-extension-policy",
transformIndexHtml(html) {
// Manifest V3 supplies the extension-page CSP. The Electron/web policy
// contains directives that Chrome extensions are not allowed to use.
// UserJot loads a remote script. It remains available in the desktop
// and Android clients, but Chrome Web Store extensions must ship all
// executable code in their package.
return html
.replace(
/\s*<meta http-equiv="Content-Security-Policy"[^>]*>\s*/,
"\n",
)
.replace(
/\s*<!-- UserJot Widget -->[\s\S]*?<!-- End UserJot Widget -->\s*/,
"\n",
);
},
},
],
build: {
outDir: resolve("dist/build/chrome-extension/unpacked"),
emptyOutDir: true,
rolldownOptions: {
input: {
index: resolve("src/renderer/index.html"),
},
},
},
});