forked from chipsTM/SevenTV-Extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.worker.ts
44 lines (38 loc) · 893 Bytes
/
vite.config.worker.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
import { displayName as name, version } from "./package.json";
import path from "path";
import { defineConfig, loadEnv } from "vite";
const r = (...args: string[]) => path.resolve(__dirname, ...args);
export default defineConfig(() => {
const mode = process.env.NODE_ENV;
const outDir = process.env.OUT_DIR || "";
process.env = {
...process.env,
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: name,
VITE_APP_VERSION: version,
VITE_APP_VERSION_BRANCH: process.env.BRANCH,
};
process.stdout.write("Building worker...\n");
return {
mode,
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
root: ".",
build: {
outDir: "dist" + "/" + outDir,
emptyOutDir: false,
write: true,
rollupOptions: {
input: {
worker: r("src/worker/worker.root.ts"),
},
output: {
entryFileNames: "worker.js",
},
},
},
};
});