// https://nuxt.com/docs/api/configuration/nuxt-config import { disableImportProtection } from './nuxt.config.workaround' export default defineNuxtConfig({ ssr: false, compatibilityDate: '2025-07-15', devtools: { enabled: true }, css: ['~/assets/css/main.css'], modules: ['@nuxt/image', '@nuxt/ui', '@nuxt/test-utils', '@vite-pwa/nuxt', '@pinia/nuxt'], // Performance optimizations experimental: { payloadExtraction: false, viewTransition: true }, // Optimize build vite: { plugins: [disableImportProtection()], server: { hmr: { clientPort: 443, protocol: 'wss' }, allowedHosts: [ '.nucleoriofrio.com', 'devserver.nucleoriofrio.com', 'analitica.nucleoriofrio.com' ] }, build: { cssCodeSplit: true, rollupOptions: { output: { manualChunks: { 'vendor-ui': ['@nuxt/ui'], 'vendor-pinia': ['pinia', '@pinia/nuxt'] } } } } }, app: { baseURL: process.env.BASE_URL || '/', head: { link: [ { rel: 'icon', type: 'image/png', href: `${process.env.BASE_URL || ''}/icons/icon-192.png` }, { rel: 'apple-touch-icon', sizes: '192x192', href: `${process.env.BASE_URL || ''}/icons/icon-192.png` }, { rel: 'manifest', href: `${process.env.BASE_URL || ''}/manifest.webmanifest` } ], meta: [ { name: 'theme-color', content: '#1b1209' }, { name: 'apple-mobile-web-app-capable', content: 'yes' }, { name: 'mobile-web-app-capable', content: 'yes' }, { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' } ] } }, nitro: { baseURL: process.env.BASE_URL || '/', experimental: { openAPI: true }, routeRules: { '/manifest.webmanifest': { headers: { 'Content-Type': 'application/manifest+json', 'Cache-Control': 'public, max-age=3600' } }, '/sw.js': { headers: { 'Service-Worker-Allowed': '/', 'Cache-Control': 'public, max-age=0' } } } }, pwa: { registerType: 'autoUpdate', strategies: 'generateSW', manifestFilename: 'manifest.webmanifest', manifest: { name: 'Analítica Núcleo Data Studio', short_name: 'Analítica', description: 'Explora y valida tus tablas Supabase desde un único panel en modo lectura.', start_url: process.env.BASE_URL || '/', scope: process.env.BASE_URL || '/', display: 'standalone', background_color: '#1b1209', theme_color: '#c08040', icons: [ { src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' }, { src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' }, { src: '/icons/icon-192-maskable.png', sizes: '192x192', type: 'image/png', purpose: 'maskable' }, { src: '/icons/icon-512-maskable.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }, { src: '/icons/icon-192-black.png', sizes: '192x192', type: 'image/png' }, { src: '/icons/icon-512-black.png', sizes: '512x512', type: 'image/png' } ], screenshots: [ { src: '/screenshots/screenshot-desktop.png', sizes: '2048x1041', type: 'image/png', form_factor: 'wide', label: 'Dashboard en escritorio' }, { src: '/screenshots/screenshot-mobile.png', sizes: '774x1459', type: 'image/png', form_factor: 'narrow', label: 'Vista móvil' } ] }, workbox: { globPatterns: ['**/*.{js,css,html,png,svg,webp,ico,json,woff2}'], navigateFallback: undefined, // Disable navigation fallback for SPA cleanupOutdatedCaches: true, maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, runtimeCaching: [ { urlPattern: /^https:\/\/szesytydotpnuiuwybwb\.supabase\.co\//, handler: 'NetworkFirst', method: 'GET', options: { cacheName: 'supabase-data', networkTimeoutSeconds: 10, expiration: { maxEntries: 60, maxAgeSeconds: 3600 }, cacheableResponse: { statuses: [0, 200] } } } ] }, client: { installPrompt: true, periodicSyncForUpdates: 3600 }, devOptions: { enabled: process.env.NODE_ENV === 'development', type: 'module' }, includeAssets: [ 'favicon.ico', 'icons/icon-192.png', 'icons/icon-512.png', 'icons/icon-192-maskable.png', 'icons/icon-512-maskable.png', 'icons/icon-192-black.png', 'icons/icon-512-black.png', 'screenshots/screenshot-desktop.png', 'screenshots/screenshot-mobile.png' ] }, runtimeConfig: { supabase: { url: process.env.SUPABASE_URL || process.env.NEXT_PUBLIC_SUPABASE_URL, serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY || process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY } } })