Files
budget-manager/frontend/vite.config.ts
T
biggy 8681aa88af feat: Implement push notifications in Budget Manager PWA
- Added functionality for subscribing to push notifications in Settings.vue.
- Integrated service worker registration and notification permission requests.
- Enhanced Vite configuration for PWA with manifest and caching strategies.
- Created a script for generating PDF reports.
- Added project report markdown file detailing the PWA implementation and features.
2025-05-23 23:54:46 +02:00

99 lines
2.6 KiB
TypeScript

import tailwindcss from "@tailwindcss/vite";
import vue from "@vitejs/plugin-vue";
import path from "node:path";
import { defineConfig } from "vite";
import vueDevTools from "vite-plugin-vue-devtools";
import { VitePWA } from "vite-plugin-pwa";
import VueRouter from "unplugin-vue-router/vite";
// https://vite.dev/config/
export default defineConfig({
plugins: [
VueRouter(),
vue(),
vueDevTools(),
tailwindcss(),
VitePWA({
registerType: "autoUpdate",
devOptions: { enabled: true },
manifest: {
name: "Budget Manager",
short_name: "BudgetMgr",
description: "Track and manage your finances",
theme_color: "#ffffff",
icons: [
{
src: "/icons/icon-192px.jpg",
sizes: "192x192",
type: "image/png"
},
{
src: "/icons/icon-512px.jpg",
sizes: "512x512",
type: "image/png"
}
]
},
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,jpg}"],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "gstatic-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days
},
cacheableResponse: {
statuses: [0, 200]
},
}
},
{
urlPattern: /\/api\/(?!.*auth).*/i, // All API routes except auth
handler: "NetworkFirst",
options: {
cacheName: "api-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 // 1 hour
}
}
}
]
}
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
proxy: {
"/api": {
target: "http://localhost:3000", // Replace with your API server URL
changeOrigin: true,
},
},
port: 3001, // Replace with your desired port
},
});