Universal plugin to inject <link rel='preload'> tags into HTML output for Vite 4/5, Webpack 5 (with HtmlWebpackPlugin), and Rspack 1.0 (with HtmlWebpackPlugin or HtmlRspackPlugin). Current stable version is 3.0.0, released with Rspack 1.0 support and dropped support for Rspack 0.x. Replaces separate packages vite-plugin-inject-preload and html-webpack-inject-preload. Ships TypeScript types. Release cadence is irregular, with minor releases featuring breaking changes. Key differentiator: single unified API across multiple bundlers.
npm install unplugin-inject-preloadVerified import paths — ran on the pinned version, not inferred.
Configure Vite to inject preload links for all .woff2 and .woff font files built by the bundler.
Upgrade Rspack to 1.0.x or later. For Rspack 0.x, stick with v2.x.
Upgrade to Vite 4 or 5.
Update your `outputMatch` regex to handle base64 hashes (e.g., allow longer alphanumeric strings).
Test preload injection with `vite build` only. Dev server will not inject preload links.
Ensure you are using the correct import path: 'unplugin-inject-preload/vite', '/webpack', or '/rspack'. Also verify the package is installed.
Use default import: import UnpluginInjectPreload from 'unplugin-inject-preload/vite'
Install html-webpack-plugin@>=5.0.0 as a devDependency.