1.0.1 • Published 12 months ago

@fast-tools/preconnect-auto-insert v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@fast-tools/preconnect-auto-insert


version icon webpack plugin

A very tiny webpack plugin which can insert preconnect & dns-prefetch link tags automatically into your html head tag, improving your website first screen loading speed. If you want to know more about how it works, see this page

See website for more information or the issues associated with this package.

Install


Using npm:

npm install --save-dev @fast-tools/preconnect-auto-insert

or using yarn:

yarn add --dev @fast-tools/preconnect-auto-insert

Basic Usage


Include the following in your webpack config:

const { PreconnectTools } = require('@fast-tool/preconnect-auto-insert');

module.exports = {
  plugins: [
    /*
    Basically, it doesn't need an optional hash param, because the plugin will analysis all domains that will be used in the first screen and insert the link tags at the head tag to ensure it can work.
    But if you want, you can add domain (as a string or a domain array) that you want insert or ignore.
    */
    new PreconnectTools({
      customDomains: '', // some domains you want to add
      ignoreDomains: '' // some domains you want to ignore
    })
  ]
};

Options


You can pass a hash of configuration options to preconnect-auto-insert. Allowed values are as follows:

nametypedefaultdescription
customDomainsstring | string[]''domains that you want to add
ignoreDomainsstring | string[]''domains that you want to ignore
1.0.1

12 months ago

1.0.0

12 months ago