тесты
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

86 lines
2.9 KiB

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { VitePWA } from "vite-plugin-pwa";
import { nodePolyfills } from 'vite-plugin-node-polyfills';
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: "0.0.0.0",
port: 5173
},
plugins: [
nodePolyfills(),
react(),
VitePWA({
registerType: 'autoUpdate',
workbox: {
globPatterns: ["**/*"],
runtimeCaching: [
{
urlPattern: function (_a) {
var request = _a.request;
return request.mode === 'navigate';
},
handler: 'NetworkFirst',
options: {
cacheName: 'html-cache',
},
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'static-resources',
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
handler: 'CacheFirst',
options: {
cacheName: 'image-cache',
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
]
},
includeAssets: [
"**/*",
],
manifest: {
"theme_color": "#f69435",
"background_color": "#f69435",
"display": "standalone",
"scope": "/",
"start_url": "/",
"short_name": "Vite PWA",
"description": "Vite PWA Boilerplate",
"name": "Vite PWA Boilerplate",
"icons": [
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
},
}),
],
});