4

I've built a PWA using angular 6 and the @angular/pwa package.

I've been trying to fix this but no matter what I do, I'm getting the start_url error. I have tried:

  • Using absolute links
  • Making sure the start_url is within the SW's scope (sw is in the main folder)
  • Using the filename "/index.html" as I've seen in other support threads here.
  • Clearing all browser history and cache everytime.
  • Searching through Github issues on the @angular/pwa package
  • Searching google in general for this PWA issue.

Here's my manifest:

{
  "name": "BC Doc View",
  "short_name": "BCview",
  "theme_color": "#1976d2",
  "background_color": "#fafafa",
  "display": "standalone",
  "scope": "/",
  "start_url": "/",

After this piece of code there's just a bunch of icons, irrelevant to this post.

My configuration for the service worker:

{
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "BC Doc View",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/*.css",
          "/*.js"
        ]
      }
    }, {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**"

My actual produced service worker using the ng build --prod command is 2200 lines of code so I don't think it would be relevant to post that here.

Have no idea what I'm missing on this one.

SebastianG
  • 8,563
  • 8
  • 47
  • 111

1 Answers1

0

I've cried with this error for 3 hours, minutes after I post it here I found the solution.

I've been testing this into a dev subdomain and accessing it like subdomain.domain.com/folder

Once I've put everything in the main folder I'm getting a 100 PWA score.

https://i.stack.imgur.com/BsYBL.png

I have yet to optimize performance though.

SebastianG
  • 8,563
  • 8
  • 47
  • 111
  • Hi @SebastianG can you post your working code and highlight the difference with the code from your question ? I don't see what you changed exactly. – foobar443 Oct 07 '18 at 15:40
  • 1
    @seza443 code is unchanged. What changed is that i deployed it in a top level domain vs in a folder on a domaine. dev.domain.com/myApp --- deploying in that myapp folder on that subdomain didnt work but just copying the exact same files to dev.domain.com has worked flawlessly. – SebastianG Oct 07 '18 at 16:00
  • You don't need to copy your stuff in main folder(or any 'X' folder according to your deployment) as you can set the `scope` key parameter in `manifest` accordingly. See https://developers.google.com/web/fundamentals/web-app-manifest/#scope – Sahil Babbar Mar 09 '19 at 12:52
  • I discontinued work on that project several months ago sadly so I can't go back and test it out. – SebastianG Mar 11 '19 at 17:09