No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How configure to cache external images with service worker in 0.15?

    Framework
    3
    8
    2185
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wjndy4 last edited by wjndy4

      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

      1 Reply Last reply Reply Quote 1
      • a47ae
        a47ae last edited by

        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

        1 Reply Last reply Reply Quote 0
        • W
          wjndy4 last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • W
            wjndy4 last edited by

            Hi a47ae, I just tested. External images were not cached.

            1 Reply Last reply Reply Quote 0
            • a47ae
              a47ae last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • W
                wjndy4 last edited by

                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

                1 Reply Last reply Reply Quote 0
                • rstoenescu
                  rstoenescu Admin last edited by rstoenescu

                  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

                  1 Reply Last reply Reply Quote 0
                  • W
                    wjndy4 last edited by

                    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 add runtimeCaching?

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post