jantimon / jantimon/html-webpack-plugin

Bug with images using dev server

Open
#1,714 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
JavaScript
Stars
10.7k
Forks
1.3k
Avg merge
1m
Merged PRs (30d)
1

Description

## Current behaviour 💣

Hello! I tried to use [image-minimizer-webpack-plugin](https://webpack.js.org/plugins/image-minimizer-webpack-plugin/) in dev server but there's something strange. I have generators (for `.webp` and `.avif`) and i try to require it in HTML (in my case it is `.pug` but never mind). When i have one require it is ok, but when i have two requires or more - the last one generates image, each previous returns default value (in my case it is `.jpg`).

## Expected behaviour ☀️

All requires will generate expected file independently of count

### Reproduction Example 👾

- [Video demonstration](https://www.youtube.com/watch?v=l1Q6V9ELIdk&ab_channel=VolodymyrDoskochinskiy)
- [Webpack configuration](https://github.com/dx1ded/webpack-mpa/blob/main/webpack.config.js)

## Environment 🖥

- **nodejs** - `v15.9.0`
- **npm** - `v7.6.3`
- **webpack** - `v5.65.0`
- **webpack-cli** - `v4.9.1`
- **webpack-dev-server** - `v4.7.0`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked webpack.config.js and reproduce the case using webpack-dev-server, image-minimizer-webpack-plugin, and multiple image requires from the Pug HTML entry. Compare single and multiple requires, then verify that every require produces its expected generated image rather than the default .jpg value.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.