79 lines
2.4 KiB
TypeScript
79 lines
2.4 KiB
TypeScript
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
VitePWA({
|
|
registerType: "autoUpdate",
|
|
includeAssets: ["favicon.svg", "icons/*.png"],
|
|
workbox: {
|
|
runtimeCaching: [
|
|
{
|
|
urlPattern: /^https?:\/\/.*\/api\/v1\/ideas\/?/i,
|
|
handler: "NetworkFirst",
|
|
options: {
|
|
cacheName: "voidea-ideas",
|
|
expiration: { maxEntries: 50, maxAgeSeconds: 86400 },
|
|
networkTimeoutSeconds: 5,
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /^https?:\/\/.*\/api\/v1\/voice\/sessions/i,
|
|
handler: "NetworkFirst",
|
|
options: {
|
|
cacheName: "voidea-sessions",
|
|
expiration: { maxEntries: 20, maxAgeSeconds: 3600 },
|
|
networkTimeoutSeconds: 5,
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /^https?:\/\/.*\/api\/v1\/config\/public/i,
|
|
handler: "CacheFirst",
|
|
options: {
|
|
cacheName: "voidea-config",
|
|
expiration: { maxEntries: 1, maxAgeSeconds: 86400 },
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|ico|webp)$/i,
|
|
handler: "CacheFirst",
|
|
options: {
|
|
cacheName: "voidea-images",
|
|
expiration: { maxEntries: 100, maxAgeSeconds: 604800 },
|
|
},
|
|
},
|
|
{
|
|
urlPattern: /\.(?:js|css|woff2?)$/i,
|
|
handler: "StaleWhileRevalidate",
|
|
options: {
|
|
cacheName: "voidea-static",
|
|
expiration: { maxEntries: 100, maxAgeSeconds: 604800 },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
manifest: {
|
|
name: "VoIdeaAI",
|
|
short_name: "VoIdeaAI",
|
|
description: "VoIdeaAI — идеи рождаются вслух, решения приходят мгновенно!",
|
|
theme_color: "#1e1b4b",
|
|
background_color: "#f9fafb",
|
|
display: "standalone",
|
|
start_url: "/",
|
|
icons: [
|
|
{ src: "/icons/icon-192x192.png", sizes: "192x192", type: "image/png" },
|
|
{ src: "/icons/icon-512x512.png", sizes: "512x512", type: "image/png" },
|
|
],
|
|
},
|
|
}),
|
|
],
|
|
server: {
|
|
port: 3000,
|
|
proxy: {
|
|
"/api": "http://localhost:8020",
|
|
},
|
|
},
|
|
});
|