-
Notifications
You must be signed in to change notification settings - Fork 98
/
vite.config.worker.mts
47 lines (41 loc) · 1.02 KB
/
vite.config.worker.mts
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
import { displayName as name } from "./package.json";
import { getFullVersion } from "./vite.utils";
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 || "";
const isNightly = process.env.BRANCH === "nightly";
const fullVersion = getFullVersion(isNightly);
process.env = {
...process.env,
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: name,
VITE_APP_VERSION: fullVersion,
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",
},
},
},
};
});