-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
54 lines (52 loc) · 1.57 KB
/
vite.config.ts
File metadata and controls
54 lines (52 loc) · 1.57 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
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import tailwind from "@tailwindcss/vite";
import sqlocal from "sqlocal/vite";
import { VitePWA } from "vite-plugin-pwa";
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const isGitHub = mode === 'github';
const base = isGitHub ? '/context-replace/' : '/';
return {
base,
server: {
headers: {
// "Cross-Origin-Embedder-Policy": "require-corp",
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "credentialless", // 更宽松
},
},
plugins: [
vue(),
tailwind(),
sqlocal(),
VitePWA({
registerType: "autoUpdate",
manifest: {
name: "Context Replace",
short_name: "Context Replace",
description:
"An offline tool to replace sensitive text in your context",
theme_color: "#ffffff",
// id: "/", // 固定应用 ID
start_url: isGitHub ? "/context-replace/" : "/",
display: "fullscreen", // 👈 关键
icons: [
{
src: isGitHub ? "/context-replace/icon-192.png" : "/icon-192.png",
sizes: "192x192",
type: "image/png",
purpose: "any maskable", // 关键!
},
{
src: isGitHub ? "/context-replace/icon-512.png" : "/icon-512.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable",
},
],
},
}),
],
};
});