jantimon / jantimon/resource-hints-webpack-plugin

Prefetch/preload any Webpack asset instead of HTMLWebpackPlugin tags

Open
#8 1 comment 16 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
100
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Right now the plugin will only add prefetch/preload `` for assets, that already have a tag somewhere else in the document (where the tag was generated by HTMLWebpackPlugin).

For my usecase I'd like to be able to prefetch assets that are loaded using Webpack's file-loader. My application is loading an image and a font using file-loader and referencing the files dynamically in the bundle. The paths to the assets don't appear in the HTML template, but do appear in the bundle. Right now they are just not picked up by this plugin.

I'd like to be able to apply the filters (e.g `img/*.png`) here, so that prefetch links for the images are added to the template. This seems to echo what @chrisui's mentions in [his comment](https://github.com/jantimon/resource-hints-webpack-plugin/issues/4#issuecomment-310683495).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the plugin identifies assets already represented by HTMLWebpackPlugin tags, then inspect how its filters could apply to assets referenced in the bundle. The change is complete when matching file-loader image and font assets produce prefetch or preload links in the generated HTML template without requiring existing tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.