forked from mayneyao/eidos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
82 lines (79 loc) · 2.14 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import fs from "fs"
import path from "path"
import react from "@vitejs/plugin-react"
import { visualizer } from "rollup-plugin-visualizer"
import { PluginOption, defineConfig } from "vite"
import { VitePWA } from "vite-plugin-pwa"
const iconPath = path.resolve(__dirname, "icons.json")
const iconJson = JSON.parse(fs.readFileSync(iconPath, "utf-8"))
const config = defineConfig({
// define: {
// global: {},
// },
plugins: [
react(),
VitePWA({
srcDir: "app",
filename: "sw.ts",
strategies: "injectManifest",
injectManifest: {
// 7MB
maximumFileSizeToCacheInBytes: 7 * 1024 * 1024,
globPatterns: ["**/*.{js,css,html,ico,png,svg,wasm}"],
},
includeAssets: ["favicon.ico", "apple-touch-icon.png", "mask-icon.svg"],
manifest: {
name: "Eidos",
short_name: "Eidos",
description:
"An extensible framework for managing your personal data throughout your lifetime in one place",
theme_color: "#ffffff",
icons: iconJson.icons,
display_override: ["window-controls-overlay"],
display: "standalone",
// display: "standalone",
file_handlers: [
// not ready yet
// {
// action: "/editor/doc",
// accept: {
// "text/markdown": [".md", ".markdown"],
// },
// },
],
},
registerType: "prompt",
workbox: {
// globPatterns: ["**/*.{js,css,html,ico,png,svg,wasm}"],
clientsClaim: true,
skipWaiting: true,
},
devOptions: {
enabled: true,
type: "module",
},
}),
visualizer({
gzipSize: true,
brotliSize: true,
emitFile: false,
filename: "dev-pkg-vis.html",
open: true,
}) as unknown as PluginOption,
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./"),
},
},
server: {
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
},
},
optimizeDeps: {
exclude: ["@sqlite.org/sqlite-wasm", "whisper-webgpu"],
},
})
export default config