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

    PWA service worker is not caching index.html

    Help
    2
    6
    2923
    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.
    • D
      danielo515 last edited by danielo515

      Hello everyone,
      According to PWA documentation we should expect:

      Lighthouse score of 90+/100

      I was wondering what is the reason, and what can be done to fix it.
      Apart from that, I am getting an error on Lighthouse that says that my main index file is not being cached by a service worker. This is not true because opening the network tab I can see that the main page is being served from the service worker and the app works fine offline. However, the problem may by that my main page is not called index.html, but instead it has the name of my subpath (it’s being served from within my domain).

      This is the exact error

      Failures: Manifest start_url is not cached by a Service Worker.

      And here it is my manifest file

      {
        "name": "JSON tools",
        "short_name": "JSONTools",
        "icons": [{
            "src": "/statics/icons/icon-192x192.png",
            "sizes": "192x192",
            "type": "image/png"
          },
          {
            "src": "/statics/icons/icon-512x512.png",
            "sizes": "512x512",
            "type": "image/png"
          }
        ],
        "start_url": "JSONTools",
        "display": "standalone",
        "background_color": "#ffffff",
        "theme_color": "#027be3"
      }
      

      As you can see, I tried to change the start_url to match my subdomain name, but that does not work either.

      I want to fill that gap. It’s not important for my current project, but it will be for many projects I plan to build with Quasar.
      My page (if someone wants to test) is www.danielorodriguez.com/JSONTools

      Thanks in advance.

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

        Seems like an awesome tool you’re building there. Please open up a github ticket on PWA template repo and I’ll investigate. Thanks for reporting.

        PS: The PWA score from my tests is 99/100

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

          Not getting any error on the link you indicated… Am I missing something? Provide as many details as possible pls. Thanks.

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

            Oh, I see now. In your case, just add start_url property to the manifest file (/src/statics/manifest.json), pointing it to https://www.danielorodriguez.com/JSONTools/. Cannot do that from the starter kit as the URL varies according to where it’s going to get deployed.

            1 Reply Last reply Reply Quote 0
            • D
              danielo515 last edited by

              Hello @rstoenescu
              Thanks for your prompt response and your kind words!
              I expected the start_url on the manifest to be a bit less specific. I mean, I expected to be able to just specify a relative path. I understand that this is how browsers (or lighthouse) works and that you can’t know it beforehand. However, a small note on the PWA starter kit documentation will help newcomers.

              I tried adding the full url as you suggested to the manifest and then the service_worker does not work at all. Is there anything else should I do ?

              If you like the tool, feel free to link it whenever you want 😄

              1 Reply Last reply Reply Quote 0
              • D
                danielo515 last edited by

                Ok, there should be something weird with the cache after the build process. I manually updated the manifest file directly on the gh_pages branch to point to https://www.danielorodriguez.com/JSONTools/ and now I get 100 of 100 on the PWA check and the service worker works fine.

                I’ll try again to set it on the master branch and let it build to see if it happens again.

                Many thanks!!!

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