gatsby-plugin-manifest omits asset prefix in manifest.webmanifest icon URLs

Created on 22 Jun 2020  ·  6Comments  ·  Source: gatsbyjs/gatsby

Description

Currently, gatsby-plugin-manifest is prefixing the URL to the icons in manifest.webmanifest with the pathPrefix config value only. I would assume, like other assets, the icons in the manfiest should be prefixed with assetPrefix followed by pathPrefix. Weirdly though, the favicon and other app icons that are inserted the document's <head> are prefixed with assetPrefix and pathPrefix as expected so there's an inconsistency between icon URLs in gatsby's html document and ones inside manifest.webmanifest.

Steps to reproduce

See https://github.com/disintegrator/gatsby-25207

Expected result

  1. URL of icons added to the <head> of pages are prefixed with assetPrefix and then pathPrefix.
  2. URL of favicon and inside of manifest.webmanifest are prefixed with assetPrefix and then pathPrefix.

Actual result

✅ (working) URL of icons added to the <head> of pages are prefixed with assetPrefix and then pathPrefix.
❌ (not working) URL of favicon and inside of manifest.webmanifest are only prefixed with pathPrefix .

Environment

  System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 5.7.1 - /usr/local/bin/zsh
  Binaries:
    Node: 12.18.1 - /var/folders/11/zcvk9j4j7rd_dj0t5hcv9wc80000gp/T/yarn--1592842676680-0.26237458001029235/node
    Yarn: 1.22.4 - /var/folders/11/zcvk9j4j7rd_dj0t5hcv9wc80000gp/T/yarn--1592842676680-0.26237458001029235/yarn
    npm: 6.14.5 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 83.0.4103.106
    Firefox: 77.0.1
    Safari: 13.1.1
  npmPackages:
    gatsby: ^2.23.3 => 2.23.3
    gatsby-image: ^2.4.7 => 2.4.7
    gatsby-plugin-manifest: ^2.4.11 => 2.4.11
    gatsby-plugin-offline: ^3.2.9 => 3.2.9
    gatsby-plugin-react-helmet: ^3.3.4 => 3.3.4
    gatsby-plugin-sharp: ^2.6.11 => 2.6.11
    gatsby-source-filesystem: ^2.3.11 => 2.3.11
    gatsby-transformer-sharp: ^2.5.5 => 2.5.5
  npmGlobalPackages:
    gatsby-cli: 2.7.15
PWA bug

Most helpful comment

Ok. Then if someone more than me is wondering about this, #18497 was incorrectly closed since the problem I described there was concerning assetPrefix and not pathPrefix. Thanks @disintegrator for creating a new issue to keep this alive since the problem still exists.

All 6 comments

Thanks for letting us know about this issue, @disintegrator! I'm tagging @moonmeister in case he has context on this.

I don't have any specific background, I remember working on this PR with core team but nothing specific that'd help. This probably just got over looked. I'll take a look at the repro when I get a chance.

Here's the original PR: https://github.com/gatsbyjs/gatsby/pull/20142

@wardpeet Looks like the you did most this work, basePath being used doesn't seem to be providing the asset prefix. Is there a way to fix this?

Is there any difference between this issue and #18497? Was this not resolved in #20142?

We fixed all pathPrefix related issues but the assetPrefix specifically is still not getting applied correctly inside the manifest file. It's a bug in the original fix.

Ok. Then if someone more than me is wondering about this, #18497 was incorrectly closed since the problem I described there was concerning assetPrefix and not pathPrefix. Thanks @disintegrator for creating a new issue to keep this alive since the problem still exists.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferMartz picture ferMartz  ·  3Comments

magicly picture magicly  ·  3Comments

ghost picture ghost  ·  3Comments

Oppenheimer1 picture Oppenheimer1  ·  3Comments

kalinchernev picture kalinchernev  ·  3Comments