question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Workbox options are added to workbox.core instead of workbox

See original GitHub issue

Although I am sure some workbox options should indeed be added to workbox.core, others that are standard (such as skipWaiting and clientsClaim) should instead be added to workbox top level.

To Reproduce Steps to reproduce the behavior:

  1. Go to quasar.conf.js and add workboxOptions: { skipWaiting: true } under pwa
  2. load pwa in web browser

Expected behavior That the option will be properly added

Actual behavior Option is not loaded and browser throws an error: Uncaught TypeError: workbox.core.skipWaiting is not a function

This is because not all options are appropriate to add to core, some (like skipWaiting) should be added above. The correct option should be workbox.skipWaiting()

Workaround Create custom service worker file and add options manually.

Possible Solution Perhaps there should be two options available in quasar.conf.js, one for workboxCoreOptions and one for workboxOptions? Or some warning about invalid options?

btw, here is my quasar config info: Operating System - Darwin(18.7.0) - darwin/x64 NodeJs - 11.11.0

Global packages NPM - 6.10.3 yarn - Not installed @quasar/cli - 1.0.0 cordova - 8.1.2 (cordova-lib@8.1.1)

Important local packages quasar - 1.1.0 – Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time @quasar/app - 1.0.5 – Quasar Framework local CLI @quasar/extras - 1.3.1 – Quasar Framework fonts, icons and animations vue - 2.6.10 – Reactive, component-oriented view layer for modern web interfaces. vue-router - 3.1.2 – Official router for Vue.js 2 vuex - 3.1.1 – state management for Vue.js electron - Not installed electron-packager - Not installed electron-builder - Not installed @babel/core - 7.5.5 – Babel compiler core. webpack - 4.39.3 – Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, … and your custom stuff. webpack-dev-server - 3.8.0 – Serves a webpack app. Updates the browser on changes. workbox-webpack-plugin - 4.3.1 – A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache. register-service-worker - 1.6.2 – Script for registering service worker, with hooks

Quasar App Extensions @quasar/quasar-app-extension-icon-genie - 1.0.1 – A Quasar CLI Extension for Making All Your Icons

Networking Host - ssuess-pro en0 - 193.0.21.19 utun3 - 10.245.2.181

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rstoenescucommented, Aug 29, 2019

Hi @ssuess ,

I just tested with quasar/app 1.0.5 (that you also have), and seems to be working correctly (no errors).

At best, this would be an error to report to workbox for their workbox-webpack-plugin. All options are passed to their plugin, and if the plugin does not generate the right content, it can only be due to a problem in their package. But I tested it and no error pops out.

Here’s the generated service-worker.js file (stripped out comments):

importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
  "precache-manifest.9cf5b321dd467d1e3caec05ef82c8bbf.js"
);

workbox.core.setCacheNameDetails({prefix: "tvuex"});

workbox.core.skipWaiting();

self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

Are you sure that you are testing the right URL with the latest generated service worker? Might happen, who knows… Any cache issues somehow on the workbox-sw.js from above? If you can confirm that you have eliminated this chance, can you share a reproducing repo pls? I’ve tested and tested and couldn’t reproduce. Thanks!

0reactions
rstoenescucommented, Aug 30, 2019

Interesting… then it’s definitely something related to how yarn/npm managed the packages. Will close this, but please do share your findings here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The ways of Workbox - Chrome Developers
You'll rely on one of two core methods of Workbox's build tools: generateSW or injectManifest . Which one you should use depends on...
Read more >
Workbox Module
This module adds full offline support using workbox. You can pass options to pwa.workbox in nuxt.config.js to override the defaults. nuxt.config.js
Read more >
Create a service worker with Workbox, Webpack and TypeScript
JavaScript Libraries for adding offline support to web apps…Welcome, Workbox is a set of libraries and Node modules that make it easy to...
Read more >
Frontend caching in Vue with Workbox service workers
Add the Workbox plugin for Vue with the following command: vue add pwa ... The other option, GenerateSW , does not require a...
Read more >
workbox-core
This module is used by a number of the other Workbox modules to share common code.. Latest version: 6.5.4, last published: 5 months...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found