-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.ts
41 lines (37 loc) · 1.09 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
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vite";
import webExtension, { readJsonFile } from "vite-plugin-web-extension";
function generateManifest() {
const manifest = readJsonFile("src/manifest.json");
const pkg = readJsonFile("package.json");
// Until https://bugzil.la/1766026 has been fixed, we need to keep using
// manifest_version 2 for Firefox.
const manifestVersion = process.env.TARGET === "firefox" ? 2 : 3;
return {
...manifest,
name: "Copy Guard",
description: pkg.description,
version: pkg.version,
manifest_version: manifestVersion,
};
}
// https://vitejs.dev/config/
export default defineConfig({
build: {
target: 'esnext'
},
define: {
__VERSION__: JSON.stringify(readJsonFile("package.json").version),
},
plugins: [
svelte(),
webExtension({
browser: process.env.TARGET || "chrome",
manifest: generateManifest,
watchFilePaths: ["package.json", "manifest.json"],
webExtConfig: {
startUrl: process.env.START_URL || "https://example.com",
},
}),
],
});