How configure to cache external images with service worker in 0.15?
-
Hello,
My app stores images using firebase. In 0.14, I did it using webpack.prod.conf. What should I do in order to do similar things in 0.15?
I cached external images using sw-toolbox -
If you use
quasar mode -a pwa
the generated manifestshould already have caching for images enabled:
http://quasar-framework.org/guide/pwa-configuring-pwa.html#Configuring-Manifest-File -
Thank you for your reply, a47ae. I thought that it just cache local images. So the images which stored on other domains were also cached?
-
Hi a47ae, I just tested. External images were not cached.
-
Oh than I misinterpreted the caching rules. I guess internal images are cached?
But you still should be able to add caching by editing the generated service worker. -
I did it in 0.14 by editing webpack.prod.conf. I used sw-toolbox. But, now I do not know how to do the same things in 0.15
-
http://quasar-framework.org/guide/pwa-configuring-pwa.html
You might also need to tweak the webpack config. For this, use quasar.conf.js > build > extendWebpack (cfg) -> http://quasar-framework.org/guide/app-quasar.conf.js.html#Extending-Webpack-Config-Object -
I configured like below code
new SWPrecacheWebpackPlugin({ cacheId: 'wapps', filename: 'service-worker.js', staticFileGlobs: ['dist/**/*.{js,html,css,woff,ttf,eof,woff2,json,svg,gif,jpg,png,mp3}'], minify: true, stripPrefix: 'dist/', runtimeCaching: [ { urlPattern: /^https:\/\/([\w\d]+)\.googleusercontent\.com\//, handler: 'cacheFirst' }] })
File quasar.conf.js just lack of
runtimeCaching
now. So, Is there any way to just addruntimeCaching
?