-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
62 lines (57 loc) · 1.37 KB
/
vite.config.ts
File metadata and controls
62 lines (57 loc) · 1.37 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
import { defineConfig } from "vite";
import { crx } from "@crxjs/vite-plugin";
import { resolve } from "path";
import manifestBase from "./src/manifest";
import type { ManifestV3Export } from "@crxjs/vite-plugin";
const isFirefox = process.env.VITE_BROWSER === "firefox";
// Extend the base manifest with browser-specific settings
const manifest: ManifestV3Export = async (env) => {
const base = await manifestBase(env);
if (isFirefox) {
return {
...base,
background: {
scripts: ["src/background/index.ts"],
},
browser_specific_settings: {
gecko: {
id: "jsa@chinese-room-solutions.com",
strict_min_version: "140.0",
data_collection_permissions: {
required: ["personallyIdentifyingInfo", "websiteActivity"],
optional: ["technicalAndInteraction"],
},
},
},
};
}
return base;
};
export default defineConfig({
plugins: [
crx({
manifest,
browser: isFirefox ? "firefox" : "chrome",
}),
],
server: {
port: 5173,
strictPort: true,
hmr: {
port: 5173,
},
},
build: {
outDir: isFirefox ? "dist-firefox" : "dist-chrome",
rollupOptions: {
input: {
popup: resolve(__dirname, "src/popup/index.html"),
},
},
},
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
});