quasarframework / quasar-template-pwa

[DEPRECATED] Quasar PWA Boilerplate / Starter kit
http://quasar-framework.org
MIT License
43 stars 6 forks source link

Workbox webpack plugin #15

Open laurentpayot opened 6 years ago

laurentpayot commented 6 years ago

What kind of change does this PR introduce? (check at least one)

Does this PR introduce a breaking change? (check one)

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

Other information: Feature Request #14

laurentpayot commented 6 years ago

It's working fine for my app. Added runtimeCaching section for external sources caching syntax examples.

rstoenescu commented 6 years ago

Hi, Thanks for this. Since v0.15 is so close and it has a new architecture for the starter kit, it would be best to bring this in on the new architecture. But unfortunately there's no time left to get this into v0.15 and test it thoroughly. Will add it to next version (v1.0).

laurentpayot commented 6 years ago

I understand. No problem.

rstoenescu commented 6 years ago

I think it's more to it, since we need to adjust the service-worker (dev and prod) files too. They need to use the Workbox provided API.

kevinmarrec commented 6 years ago

When Workbox 3.0 will be official, won't it be easier to migrate actual "sw-precache-webpack-plugin" used by Quasar Framework PWA to the "Workbox webpack plugin" ?

See : https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw#from_the_sw-precache-webpack-plugin_to_the_workbox_webpack_plugin

If I want to do a PWA with Quasar now, what should I do then ? Wait for a release with Workbox or deal with sw-precache for a while and the new update Quasar-cli will be able to migrate it on his own ?

laurentpayot commented 6 years ago

A third option would be to wait for Quasar-CLI to use Vue CLI 3 (with workbox plugin) but only @rstoenescu knows if that will happen some day…

kevinmarrec commented 6 years ago

My option seems easier to implement and btw if we want the feature quick, but the best (for me) is the option you mentioned, as far as we need to be updated with the last official Vue CLI, even if it makes ages (@rstoenescu said "Will add it to next version (v1.0)", but we've still no news since about 2 months and I'm not really aware about when this 1.0 version will be released).

laurentpayot commented 6 years ago

@kevinmarrec When I made this PR 4 months ago GenerateSW didn't exist, but "your" option is the same as mine: updating the PWA template with the webpack workbox plugin. All the remarks made by @rstoenescu remain valid.

kevinmarrec commented 6 years ago

@laurentpayot Okay ! I didn't look deep at what was existing 4 months ago and what exists now, but all we can do for now is wait, I guess !

laurentpayot commented 6 years ago

@kevinmarrec I think that with Quasar 0.15+ you can use the extendWebpack function of quasar.conf.js to remove the old sw-precache plugins from the webpack config object and replace it with the workbox plugin. I will try.

kevinmarrec commented 6 years ago

@laurentpayot Ok cool ! Please forward your changes/code if you succeed to make it working :)

laurentpayot commented 6 years ago

@kevinmarrec I had a look and with Quasar 0.15+ new starter kit PWA mode is much more than a webpack plugin added to the config. So yes for now all we have to do is to wait...

kevinmarrec commented 6 years ago

@laurentpayot Ok, thanks for your feedback !

Have you any advices to get started with Service Workers using Quasar PWA, considering all we talked about ? I mean should I use pw-precache for now and then migrate myself to Workbox then ?

I do not know how long will it take to get Workbox there, so... All I know : It's on the roadmap (I got a reply on Yesterday Quasar Release Tweet's).

laurentpayot commented 6 years ago

@kevinmarrec good to know it's on the roadmap! I just created this feature request: https://github.com/quasarframework/quasar-starter-kit/issues/36

sw-precache is working fine, you can go right now with Quasar pwa mode.

kevinmarrec commented 6 years ago

@laurentpayot Ok !

Have you any websites which may references sw-precache API better than the Official GitHub's one ? I'll give it a try