Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@alesmenzel/preload-webpack-plugin

alesmenzel400MIT3.0.0TypeScript support: included

A webpack plugin for injecting <link rel='preload|prefecth'> into HtmlWebpackPlugin

webpack, plugin, html-webpack-plugin, preload, resource hints

readme

@alesmenzel/preload-webpack-plugin

Pre-requisites

This module requires Webpack >= 5.0.0 and html-webpack-plugin >= 5.0.0.

Installation

npm install --save-dev @alesmenzel/preload-webpack-plugin

Usage

const PreloadWebpackPlugin = require('@alesmenzel/preload-webpack-plugin');

// ...

  plugins: [
    new HtmlWebpackPlugin({ /* ... */ }),
    new PreloadWebpackPlugin({
      include: 'initial',
      rel: 'preload',
    })
  ]
}

changelog

3.0.0

  • handle publicPath with replacement tokens (e.g. /[fullhash]/ -> /84d120e7/)
  • handle when publicPath is auto (e.g. when not set -> /)