63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
|
import { resolve } from 'path';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tailwindcss(),
|
|
react(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.svg'],
|
|
manifest: {
|
|
name: '万年历 - 农历黄历八字运势',
|
|
short_name: '万年历',
|
|
description: '农历黄历、八字排盘、每日运势',
|
|
lang: 'zh-CN',
|
|
theme_color: '#FFFBF5',
|
|
background_color: '#FFFBF5',
|
|
display: 'standalone',
|
|
orientation: 'portrait',
|
|
start_url: '/',
|
|
icons: [
|
|
{
|
|
src: 'favicon.svg',
|
|
sizes: '64x64',
|
|
type: 'image/svg+xml',
|
|
},
|
|
],
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,svg,png,woff2}'],
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
|
|
handler: 'CacheFirst',
|
|
options: {
|
|
cacheName: 'google-fonts-cache',
|
|
expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 365 },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
},
|
|
conditions: ['development', 'browser'],
|
|
},
|
|
server: {
|
|
port: 4258,
|
|
strictPort: true,
|
|
open: true,
|
|
},
|
|
build: {
|
|
target: 'es2022',
|
|
sourcemap: true,
|
|
},
|
|
});
|