Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

"auto" being appended to the generated manifest's icon src attributes #149

Open
DKulan opened this issue Dec 17, 2020 · 4 comments
Open

Comments

@DKulan
Copy link

DKulan commented Dec 17, 2020

Trying to generate a manifest based on these options:

new WebpackPwaManifest({
            name: "Food Event",
            short_name: "Foodies",
            description: "An app that allows you to view upcoming food events.",
            start_url: "../index.html",
            background_color: "#01579b",
            theme_color: "#ffffff",
            fingerprints: false,
            inject: false,
            icons: [{
                src: path.resolve("assets/img/icons/icon-512x512.png"),
                sizes: [96, 128, 192, 256, 384, 512],
                destination: path.join("assets", "icons")
            }]
        })

but I get "auto" appending in the icons src attribute for some reason:

{
  "icons": [
    {
      "src": "auto/assets/icons/icon_512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    },
    {
      "src": "auto/assets/icons/icon_384x384.png",
      "sizes": "384x384",
      "type": "image/png"
    },
    {
      "src": "auto/assets/icons/icon_256x256.png",
      "sizes": "256x256",
      "type": "image/png"
    },
    {
      "src": "auto/assets/icons/icon_192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "auto/assets/icons/icon_128x128.png",
      "sizes": "128x128",
      "type": "image/png"
    },
    {
      "src": "auto/assets/icons/icon_96x96.png",
      "sizes": "96x96",
      "type": "image/png"
    }
  ],
  "name": "Food Event",
  "short_name": "Foodies",
  "orientation": "portrait",
  "display": "standalone",
  "start_url": "../index.html",
  "description": "An app that allows you to view upcoming food events.",
  "background_color": "#01579b",
  "theme_color": "#ffffff"
}
@Abachouch
Copy link

Abachouch commented Dec 27, 2020

just add publicPath: '/', , i think its publicPath: 'auto', by default

 new WebpackPwaManifest({
   publicPath: '/' ,
   // the rest of code
})

@AlexTogar
Copy link

just add publicPath: '/', , i think its publicPath: 'auto', by default

 new WebpackPwaManifest({
   publicPath: '/' ,
   // the rest of code
})

Thanks, I've added publicPath: '.' and everything works now :)

@SMKrizan
Copy link

...this resolved my issue, too. Many thanks!

@Craig5117
Copy link

FYI, when I tried the above solution, it fixed the problem on localhost, but when I pushed to GitHub, I had a new issue with the GitHub pages version. On the GitHub deployed app, the browser took the "/" as referring to the root, and it confused dist/assets with /assets at the root level. The solution that fixed this was to replace the publicPath setting with "./". The build output for my manifest looked like this "./assets/icons/icon_512x512.png". Works the same on localhost and the live deployed version now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants