-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken icon links in Manifest file when using assetPrefix #18497
Comments
I guess it's gatsby-plugin-manifest/src/common.js that should take |
We'd be happy to receive a PR fixing this! |
This comment has been minimized.
This comment has been minimized.
So did a quick look on this. I initially tired adding prefixing to the It'd be simple enough to add a loop into the What do y'all think, should this only affect the default icon set in automatic mode, or should this also prefix developer defined paths? I can see positives of both, and downsides to both but am leaning towards prefixing everything. The downsides to prefixing everything is well, developer puts in the full path and it gets prefixed again. The benefit is the prefix is always handled by config, developer puts in the short path and it gets prefixed, if the prefix ever changes the developer only changes the build/config. Thoughts? |
The issue is also happening with me. We have a separated cdn and we used 12128 to solve that problem. Although, the solution implemented does not work with the |
Is it working for anyone using with Tried this code on exports.onPostBootstrap = async ({ basePath }) => {
console.log("onPostBootstrap: ", basePath);
}; and Thanks for any help on this! |
@moonmeister Yes! Thanks for pointing me to there... will keep track for updates in that issue. |
Description
It seems that
gatsby-plugin-manifest
does not care aboutassetPrefix
.Steps to reproduce
assetPrefix
gatsby build --prefix-paths
and compare the icon links inpublic/index.html
with the ones inmanifest.webmanifest
. Those inindex.html
are prefixed, while the ones in the manifest are not.Se this repo: https://github.com/ehannes/broken-icon-links-in-manifest, and compare icon links in public/index.html with public/manifest.webmanifest.
Expected result
Icon links in webmanifest should be prefixed with
assetPrefix
, as they are in the builtindex.html
.Actual result
Gatsby prefixes the icons correctly, for instance
href="/assets/icons/icon-48x48.png?v=4b11ef345c95e35b68f0d09fdabdc428"/>
. But in the manifest, the links are missing the asset prefix:"src": "icons/icon-48x48.png?v=4b11ef345c95e35b68f0d09fdabdc428"
. This leads to the following error in the browser console:Error while trying to use the following icon from the Manifest: http://localhost:9000/icons/icon-144x144.png?v=4b11ef345c95e35b68f0d09fdabdc428 (Download error or resource isn't a valid image)
.This is probably connected to this change: cdd800f, where the manifest file were no longer prefixed.
Environment
$ gatsby info --clipboard
The text was updated successfully, but these errors were encountered: