fix: version 3.0.1 -- Actualizador espera a backend y frontend antes de recargar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const { version } = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react(),
|
||||
{
|
||||
name: 'frontend-version',
|
||||
generateBundle() {
|
||||
this.emitFile({ type: 'asset', fileName: 'version.json', source: JSON.stringify({ version }) });
|
||||
},
|
||||
},
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
includeAssets: ['favicon.svg', 'favicon.png', 'apple-touch-icon.png'],
|
||||
@@ -25,6 +34,7 @@ export default defineConfig({
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
globIgnores: ['**/version.json'],
|
||||
// El service worker nunca debe interceptar /api — siempre a la red, nunca cache de
|
||||
// respuestas viejas (datos de proyectos/actividades desactualizados seria peor que no
|
||||
// tener PWA). navigateFallback (para que recargar una ruta como /proyectos/5 sirva el
|
||||
|
||||
Reference in New Issue
Block a user