-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.content.ts
45 lines (42 loc) · 1.05 KB
/
vite.config.content.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
45
import { appName, getFullVersion, r } from "./vite.utils";
import path from "path";
import { defineConfig, loadEnv } from "vite";
export default defineConfig(() => {
const mode = process.env.NODE_ENV ?? "";
const isDev = process.env.NODE_ENV === "dev";
const isNightly = process.env.BRANCH === "nightly";
const outDir = process.env.OUT_DIR || "";
const fullVersion = getFullVersion(isNightly);
process.env = {
...process.env,
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: appName,
VITE_APP_VERSION: fullVersion,
VITE_APP_VERSION_BRANCH: process.env.BRANCH,
VITE_APP_STYLESHEET_NAME: `seventv.style.${fullVersion}.css`,
};
return {
mode,
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
base: isDev ? "http://localhost:4777/" : "./",
build: {
emptyOutDir: false,
outDir: "dist" + "/" + outDir,
lib: {
formats: ["iife"],
entry: r("src/content/content.ts"),
name: "seventv-content",
},
rollupOptions: {
output: {
entryFileNames: "content.js",
extend: true,
},
},
},
};
});