Closed mikelax closed 5 years ago
For me too
I'm experiencing this problem as well.
It looks like the underlying webpack plugin has a prefix
option - https://github.com/jantimon/favicons-webpack-plugin/blob/master/README.md#advanced-usage - and anything you put in your options
in gatsby-config
will be passed through to webpack. There might be a hacky way to get pathPrefix
working with this but I haven't worked it out yet.
Indeed there is a weird behaviour in the favicons-webpack-plugin package with the prefix exposed by Webpack.
Here is the commit from my fork that could cause the issue while trying to fix it: https://github.com/Creatiwity/favicons-webpack-plugin/commit/f262255febeeca348bf7ae5cc140e0386c074e2c
Is there anything in your configuration that could explain the bug? I've tested it with a beta version of Gatsby, maybe the behaviour changed.
I too am having this issue with a site using a path prefix 🙁
@julien1619 the commit you are referring is indeed causing the bug:
if (publicPath.length === 0 || publicPath.substr(0) !== '/') {
publicPath.substr(0)
is not the first symbol of publicPath
. It's just a copy of publicPath
. Use publicPath.substr(0, 1)
or publicPath.charAt(0)
Oh, looks like fixed the issue in https://github.com/Creatiwity/favicons-webpack-plugin/commit/0872de414061baaad0a2853c77ae75bc38b8bbbf
but package.json
of this repo points to old commit:
Could you update it?
@RomanGotsiy Yes I'll update today or tomorrow, thanks!
Thanks!
@julien1619 would be great to update peerDependencies
"gatsby": ">2.0.0-alpha", // I think should be >=2.0.0
"react": "^16.4.2" // I think ^16 would be more appropriate
Hey, @julien1619.
Just a kindly reminder 😊
3.1.6 is now published, thanks for the reminder!
Overview
Using gatsby v2, I have a site with a value set for the
pathPrefix
parameter. Before I added this parameter, Bothgatsby develop
andgatsby build --prefix-paths
worked correctly. Now I am seeing 404 errors trying to load icons in both development and when running the site after a build.Here are example URLs that are trying to be loaded:
http://sites/somename/icons-e09e4c81dabea7f47e8e80e2478342f9/favicon-32x32.png http://sites/somename/icons-e09e4c81dabea7f47e8e80e2478342f9/favicon-16x16.png
Here are examples within the built HTML files:
<link rel="apple-touch-icon" sizes="32x32" href="//sites/somename/icons-e09e4c81dabea7f47e8e80e2478342f9/favicon-32x32.png" />
<link rel="apple-touch-icon" sizes="16x16" href="//sites/somename/icons-e09e4c81dabea7f47e8e80e2478342f9/favicon-16x16.png" />
You can see this is missing the hostname (and port when I was testing on port 8080 locally).