Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
La página del trabajador de servicio de Firebase PWA no funciona

Entonces, el problema al que nos enfrentamos actualmente es que solo se puede acceder a algunas páginas en una conexión fuera de línea, a otras no se puede acceder y regresar a la página principal, a saber, la página del Dashboard Page . Seguimos la guía de 'https://developers.google.com/web/fundamentals/primers/service-workers' para registrar trabajadores de servicios y registrarlos como importScript en el módulo 'https://pwa.nuxtjs.org/workbox' .

Aquí está nuestro código custom-sw.js:

 var CACHE_NAME = "cache-v2"; var urlsToCache = ["index.html"]; self.addEventListener("install", function (event) { event.waitUntil( caches.open(CACHE_NAME).then(function (cache) { console.log("Opened cache"); return cache.addAll(urlsToCache); }) ); }); self.addEventListener("activate", function (e) { console.log("[ServiceWorker] Activate"); e.waitUntil( caches.keys().then(function (keyList) { return Promise.all( keyList.map(function (key) { if (key !== CACHE_NAME) { console.log("[ServiceWorker] Removing old cache", key); return caches.delete(key) ; } }) ); }) ); return self.clients.claim(); }); self.addEventListener("fetch", function (event) { event.respondWith( caches.open(CACHE_NAME).then(async function (cache) { const response = await cache.match(event.request); console.log("SERVICE WORKER: ", event.request); var fetchPromise = fetch(event.request) .then(function (networkResponse) { cache.put(event.request, networkResponse.clone()); return networkResponse; }) .catch((err) => { console.log("ERROR WHILE FETCHING: ", err.message); return response; }); return response || fetchPromise; }) ); });

y Aquí está nuestro módulo pwa en nuxt.config.js:

 pwa: { // disable the modules you don't need meta: { author: "PocketAngler Ltd" }, // if you omit a module key form configuration sensible defaults will be applied manifest: { name: "PocketAngler Platform", short_name: "PocketAngler", display: "standalone", lang: "en", }, icon: { source: "/favicon.png", fileName: "favicon.png", sizes: [64, 120, 144, 152, 192, 384, 512], }, workbox: { importScripts: ["custom-sw.js"], // by default the workbox module will not install the service worker in dev environment to avoid conflicts with HMR // only set this true for testing and remember to always clear your browser cache in development dev: process.env.NODE_ENV !== "production", }, generate: { fallback: true, }, },

¿Podemos obtener la solución para este? Necesitamos abrir todas las páginas en modo fuera de línea

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda