0

我运行了 PageSpeed Insights,它告诉我这个

Preconnect to required origins
Consider adding `preconnect` or `dns-prefetch` resource hints to establish early connections to important third-party origins. Learn more.
URL
Potential Savings
https://fls-na.amazon-adsystem.com
https://ir-ca.amazon-adsystem.com
https://fonts.googleapis.com
https://images-na.ssl-images-amazon.com
https://ws-na.assoc-amazon.com

我正在使用 Gatsby,所以我使用插件 gatsby-plugin-preconnect 连接它们

{
  resolve: 'gatsby-plugin-preconnect',
  options: {
    domains: [
      "https://ir-ca.amazon-adsystem.com",
      "https://fls-na.amazon-adsystem.com",
      "https://images-na.ssl-images-amazon.com",
      "https://fonts.googleapis.com",
      "https://ws-na.assoc-amazon.com"
   ]
 }
}

然后我再次运行 PageSpeed Insights 它告诉我

Preconnect to required origins
Warnings:
A preconnect <link> was found for "https://fonts.googleapis.com" but was not used by the browser. Check that you are using the `crossorigin` attribute properly.
A preconnect <link> was found for "https://ws-na.assoc-amazon.com" but was not used by the browser. Check that you are using the `crossorigin` attribute properly.
A preconnect <link> was found for "https://images-na.ssl-images-amazon.com" but was not used by the browser. Check that you are using the `crossorigin` attribute properly.
A preconnect <link> was found for "https://fls-na.amazon-adsystem.com" but was not used by the browser. Check that you are using the `crossorigin` attribute properly.
A preconnect <link> was found for "https://ir-ca.amazon-adsystem.com" but was not used by the browser. Check that you are using the `crossorigin` attribute properly.

在预连接的情况下,我的性能得分要差得多

4

0 回答 0