Vue-storefront: Refactor the way we're generating Service Workers

Created on 14 Aug 2018  路  5Comments  路  Source: DivanteLtd/vue-storefront

@Igloczek found pretty interesting lib - https://www.npmjs.com/package/serviceworker-webpack-plugin

Would be great if somebody will be willing to do kind of PoC using it.

Acceptance criteria:

vs-hackathon

Most helpful comment

Why don't we use Workbox (https://developers.google.com/web/tools/workbox/). It's a standard and most common tool used by Nuxt, Vue-cli and is a successor of sw-toolbox. It also has standard set of rules to solve problem described in lib you mentioned.

All 5 comments

Why don't we use Workbox (https://developers.google.com/web/tools/workbox/). It's a standard and most common tool used by Nuxt, Vue-cli and is a successor of sw-toolbox. It also has standard set of rules to solve problem described in lib you mentioned.

@filrak I'm up to this solution, let's fo it

The problem is, we need a webpack pipeline to generate the service worker script, because we use the theme alias in the file https://github.com/DivanteLtd/vue-storefront/blob/master/core/service-worker/index.js
It would be better to have only one file, available to the user, with no imports. This way, we wouldn't need a Webpack pipeline for the service worker.

@filrak Can you take a lot at the Workbox migration? The CLI and nuxt are using it, it works pretty much the same as our current plugin (see https://github.com/DivanteLtd/vue-storefront-starter/blob/cli/vue.config.js for an example)

+1
When Workbox is implemented it would be great to also include a Reload alert after rebuilds

See "Offer a page reload for users"
https://developers.google.com/web/tools/workbox/guides/advanced-recipes

Was this page helpful?
0 / 5 - 0 ratings