Skip to content
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

[gatsby-plugin-offline] creates link prefetch from link preconnect #15883

Closed
cluk3 opened this issue Jul 18, 2019 · 5 comments · Fixed by #16691
Closed

[gatsby-plugin-offline] creates link prefetch from link preconnect #15883

cluk3 opened this issue Jul 18, 2019 · 5 comments · Fixed by #16691

Comments

@cluk3
Copy link

cluk3 commented Jul 18, 2019

Description

I have both gatsby-plugin gatsby-plugin-google-analytics and gatsby-plugin-offline installed.
When running lighthouse in production, it gives me the following warning:

image

Which is weird cause I'm not consuming any resource from https://marketingplatform.google.com 🤔
So i started investigating and found out that basically this is coming from 2 redirects:

image

If you look closely the initiator is gatsby-browser.
What is happening under the hood is that gatsby-plugin-google-analytics is adding a <link rel="preconnect dns-prefetch" href="https://www.google-analytics.com"> (

)
and gatsby-plugin-offline is then consuming this link an creating a link prefetch from its href 😱

Steps to reproduce

Having both the plugins above mentioned should work. You can check this starter as a reference: https://github.com/LekoArts/gatsby-starter-portfolio-cara and run lighthouse on the production demo: https://cara.lekoarts.de

Expected result

gatsby-plugin-offline should ignore link preload · prefetch · preconnect · dns-prefetch

Actual result

it just take all the links and creates a link prefetch from them.

Environment

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.12.0 - ~/n/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/n/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 75.0.3770.142
    Safari: 12.1.1
  npmPackages:
    gatsby: ^2.13.21 => 2.13.27 
    gatsby-image: ^2.2.6 => 2.2.6 
    gatsby-plugin-google-analytics: ^2.1.4 => 2.1.4 
    gatsby-plugin-manifest: ^2.2.3 => 2.2.3 
    gatsby-plugin-netlify: ^2.1.3 => 2.1.3 
    gatsby-plugin-offline: ^2.2.4 => 2.2.4 
    gatsby-plugin-react-helmet: ^3.1.2 => 3.1.2 
    gatsby-plugin-sharp: ^2.2.7 => 2.2.8 
    gatsby-plugin-sitemap: ^2.2.3 => 2.2.3 
    gatsby-plugin-styled-components: ^3.1.2 => 3.1.2 
    gatsby-plugin-tailwindcss: ^1.0.3 => 1.0.3 
    gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5 
    gatsby-source-filesystem: ^2.1.5 => 2.1.5 
    gatsby-transformer-sharp: ^2.2.3 => 2.2.4 
  npmGlobalPackages:
    gatsby-cli: 2.7.15
@cluk3
Copy link
Author

cluk3 commented Jul 18, 2019

If this is really an issue and not the expected behaviour I'd be happy to discuss a possible solution and submit a PR with the fix

@eknowles
Copy link
Contributor

does this change when reformatting the ordering of the plugins in gatsby-config?

@cluk3
Copy link
Author

cluk3 commented Jul 20, 2019

Yes, if I put gatsby-plugin-google-analytics after gatsby-plugin-offline it doesn't happen anymore, but I still think gatsby-plugin-offline should ignore link preload · prefetch · preconnect · dns-prefetch as a final and clean solution. Thanks anyway, it works amazingly as an hotfix :)

@gatsbot
Copy link

gatsbot bot commented Aug 11, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Aug 11, 2019
@gatsbot
Copy link

gatsbot bot commented Aug 22, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Aug 22, 2019
@sidharthachatterjee sidharthachatterjee added not stale and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@eknowles @cluk3 @sidharthachatterjee @LekoArts and others