performance.preconnect

  • Type: undefined | Array<string | PreconnectOption>
interface PreconnectOption {
  href: string;
  crossorigin?: boolean;
}
  • Default: undefined

Specifies that the user agent should preemptively connect to the target resource's origin, refer to preconnect.

Configuring this property will establish a connection with the server. If the site is HTTPS, this process includes DNS resolution, TCP connection establishment, and TLS handshake. Combining Preconnect and DnsPrefetch can further reduce the delay of cross-domain requests.

Example

export default {
  performance: {
    preconnect: ['https://example.com/'],
  },
};

The generated HTML tag is:

<link ref="preconnect" href="https://example.com" />
ON THIS PAGE