forked from lumen-notes/lumen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
53 lines (52 loc) · 1.77 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
import react from "@vitejs/plugin-react"
import jotaiDebugLabel from "jotai/babel/plugin-debug-label"
import jotaiReactRefresh from "jotai/babel/plugin-react-refresh"
import { visualizer } from "rollup-plugin-visualizer"
import { defineConfig } from "vite"
import type { PluginOption } from "vite"
import { nodePolyfills } from "vite-plugin-node-polyfills"
import { VitePWA } from "vite-plugin-pwa"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react({ babel: { plugins: [jotaiDebugLabel, jotaiReactRefresh] } }),
visualizer({ filename: "dist/stats.html" }) as unknown as PluginOption,
// Fixes isomorphic-git Buffer error
// https://github.com/isomorphic-git/isomorphic-git/issues/1753
VitePWA({
strategies: "generateSW",
registerType: "prompt",
injectRegister: "auto",
manifest: {
name: "Meu Segundo Cérebro",
short_name: "Segundo Cérebro",
description: "A simple note-taking app for better thinking",
theme_color: "#000000",
icons: [
{
src: "icon-1024.png",
sizes: "1024x1024",
type: "image/png",
},
],
start_url: "/",
display: "standalone",
},
workbox: {
globPatterns: ["**/*.{html,css,js,woff2}"],
ignoreURLParametersMatching: [/^utm_/, /^fbclid$/],
skipWaiting: true,
navigateFallback: "index.html",
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // 5MB
sourcemap: true,
// Do not cache edge function routes
navigateFallbackDenylist: [/cors-proxy/, /git-lfs-file/, /github-auth/],
},
devOptions: {
enabled: process.env.NODE_ENV === "development",
type: "module",
},
}),
nodePolyfills(),
],
})