forked from VinokurovVE/tests
Cleanup
This commit is contained in:
82
frontend_reactjs/vite.config.js
Normal file
82
frontend_reactjs/vite.config.js
Normal file
@ -0,0 +1,82 @@
|
||||
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({
|
||||
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"
|
||||
}
|
||||
]
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
Reference in New Issue
Block a user