workbox-webpack-plugin

How to use workbox-webpack-plugin together with Nuxt PWA

假如想象 提交于 2020-02-25 04:09:07
问题 I'm currently on Nuxt with PWA Plugin, including workbox module. However if I'm not mistaken this plugin doesn't allow to add the assets generated by webpack to precaching. Is it possible to use workbox-webpack-plugin for only generating the precaching part of the sw.js file? If so, how would it be done? There is some documentation on https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin, however I'm not sure how to apply this to the Nuxt PWA context. 回答1: Turns out

Checking for service worker updates in a single page app

天大地大妈咪最大 提交于 2020-02-23 18:37:29
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Checking for service worker updates in a single page app

不羁岁月 提交于 2020-02-23 18:37:22
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Checking for service worker updates in a single page app

巧了我就是萌 提交于 2020-02-23 18:37:02
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

How to use Laravel Mix and WorkBox?

空扰寡人 提交于 2019-12-22 09:39:52
问题 I'm trying to build a PWA for my app; and have spent almost 48 hours trying to figure out how to make use of Workbox with Laravel Mix. What's ironical is that Google says Workbox is meant to make things easy! Buh! Okay, so far I've figured out that - I will need to use the InjectManifest Plugin because I want to integrate Push notifications service in my Service Worker I have no clue how to specifiy the paths for swSrc and swDest . What code should go into my webpack.mix.js and whether I

workbox-webpack-plugin & Angular. How to listen to broadcastUpdate event in Angular

末鹿安然 提交于 2019-12-12 11:28:41
问题 I'm trying to use service-worker with my Angular Application. It is build using webpack. I use workbox-webpack-plugin. I want to serve my GET API calls form cache and in the background update the data. FOr this, I use the option runtimeCaching with the handler staleWhileRevalidate (more details on GenerateSW plugin here) This is the config I have in webpack.config.js: new GenerateSW({ // importWorkboxFrom: 'local', clientsClaim: true, skipWaiting: true, navigateFallback: '/index.html',

Workbox's precache manifest file contains invalid URL strings in Laravel Mix setting

懵懂的女人 提交于 2019-12-11 01:56:54
问题 I'm using Workbox 3.0 (webpack-plugin) and Laravel Mix (5.6) to auto-generate a ServiceWorker file. When running the webpack compiler, the manifest file generated by Workbox for pre-cached assets looks like this: self.__precacheManifest = [ { "revision": "89c25ce71806a695a25e", "url": "//js/app.js" }, { "revision": "89c25ce71806a695a25e", "url": "//css/app.css" } ]; Obviously, the URL strings are wrong and cause errors on the actual web page. Here is my webpack.mix.js : (relevant parts) const

Read env variable from service worker file using workbox

感情迁移 提交于 2019-12-10 14:46:52
问题 I'm working with workbox-sw and workbox-webpack-plugin My src sw.js file at root folder (same level with my .env file) How can I get env variables and accessing it into my src sw.js file This is from my webpack.config.js new workboxPlugin({ globDirectory: 'dist', globPatterns: ['**/*.{html,js,css,svg,otf,png,jpg,gif}'], swSrc: './sw.js', swDest: path.join('public', 'sw.js') }) Every help will be appreciated! Thanks everyone! 回答1: Because you're using swSrc: './sw.js' , that implies that the .

How can I customize my Service Worker based on environment variables?

女生的网名这么多〃 提交于 2019-12-06 23:13:14
问题 Edit: This looks like a duplicate of this Unresolved Question. Do I mark this as answered, or delete? I am using InjectManifest from workbox-webpack-plugin inside a Vue CLI 3 app. The custom service worker that I am injecting into has handling for Firebase Cloud Messaging (FCM). I need to listen for messages from different senders based on my environment (local, staging, and production). Ideally, service-worker.js would look like this: importScripts('https://www.gstatic.com/firebasejs/4.8.1

How to use Laravel Mix and WorkBox?

拥有回忆 提交于 2019-12-06 01:19:28
I'm trying to build a PWA for my app; and have spent almost 48 hours trying to figure out how to make use of Workbox with Laravel Mix. What's ironical is that Google says Workbox is meant to make things easy! Buh! Okay, so far I've figured out that - I will need to use the InjectManifest Plugin because I want to integrate Push notifications service in my Service Worker I have no clue how to specifiy the paths for swSrc and swDest . What code should go into my webpack.mix.js and whether I should have a temporary service-worker inside my resources/js folder to create a new service worker inside