@coco-platform/webpack-plugin-network-hints

Inject network hints automatic, cooperate with html-webpack-plugin.

Usage no npm install needed!

<script type="module">
  import cocoPlatformWebpackPluginNetworkHints from 'https://cdn.skypack.dev/@coco-platform/webpack-plugin-network-hints';
</script>

README

network-hints

Build Status Coverage Status Greenkeeper badge Package Dependency Package DevDependency

An extension plugin for the webpack plugin html-webpack-plugin.

Inject resource-hints into html, to improve your load time.

Installation

pre-requirement:

webpack >= 4.0.0
node >= 10.0.0

Install the plugin with npm:

$ npm install --save-dev @coco-platform/webpack-plugin-network-hints

Install the plugin with yarn:

$ yarn add --dev @coco-platform/webpack-plugin-network-hints

Usage

Load the plugin:

const {
  NetworkHintsPlugin,
} = require('@coco-platform/webpack-plugin-network-hints');

and add it to your webpack config as follow:

plugins: [
  new HtmlWebpackPlugin(),
  new NetworkHintsPlugin({
    prefetch: ['**/*.*'],
    preload: ['**/*.*'],
  }),
];

Licence

MIT