chore: sync local changes (2026-03-12)

This commit is contained in:
2026-03-12 18:58:47 +08:00
parent cf2203e3eb
commit 6c60d9c8a0
478 changed files with 5690 additions and 53453 deletions

View File

@@ -1,8 +1,68 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
plugins: [react()],
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate', // 发现新版本时自动更新
includeAssets: ['logo.png'],
manifest: {
name: '萌芽笔记',
short_name: '萌芽笔记',
description: '萌芽笔记 - Markdown 笔记 PWA',
theme_color: '#1a1a2e',
background_color: '#16213e',
display: 'standalone',
orientation: 'portrait-primary',
scope: '/',
start_url: './',
icons: [
{
src: 'logo.png',
sizes: '192x192',
type: 'image/png',
purpose: 'any'
},
{
src: 'logo.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any'
},
{
src: 'logo.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable'
},
{
src: 'logo.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
]
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
runtimeCaching: [
{
urlPattern: /^https?:\/\/.*\/api\/.*/i,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: { maxEntries: 32, maxAgeSeconds: 24 * 60 * 60 },
networkTimeoutSeconds: 10,
cacheableResponse: { statuses: [0, 200] }
}
}
]
},
devOptions: { enabled: true } // 开发时也启用 PWA 便于调试
})
],
base: './', // Ensure relative paths for assets
server: {
host: '0.0.0.0', // 监听所有网络接口(包括局域网)