SimenB / SimenB/add-asset-html-webpack-plugin

Assets refreshing not working with html-webpack-plugin v4

Open
#175 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
336
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Hi, thanks for the great work of this plugin.

It seems not working well with html-webpack-plugin v4. The compilation missing to refresh assets after assets updated.

I created a repo which can reproduce the bug. Hope it will help.

Reproducing steps:

  1. Run npm start
  2. Update assets/dll.js
  3. Watch the webpack log, it does re-compile, but no assets updated.
  4. Open the dist/dll.js, it's stale. (the devServer.writeToDisk option is just for convenience of debugging)

More info:

When webpack first started, the assets do be added:

Version: webpack 4.42.1
Time: 334ms
Built at: 04/10/2020 10:18:50 PM
          Asset       Size  Chunks             Chunk Names
         dll.js   19 bytes          [emitted]  
     index.html  263 bytes          [emitted]  
index_bundle.js    360 KiB    main  [emitted]  main
Entrypoint main = index_bundle.js

But when assets file updated, the re-compilation missed the assets.

ℹ 「wdm」: Compiling...
ℹ 「wdm」: Hash: a7a08df7cdac9b2219d8
Version: webpack 4.42.1
Time: 10ms
Built at: 04/10/2020 10:19:01 PM
 1 asset
Entrypoint main = index_bundle.js
   33 modules
ℹ 「wdm」: Compiled successfully.

And when I downgrade the html-webpack-plugin to v3, it works again.

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

Run the linked reproducing repository with npm start, then update assets/dll.js and compare the webpack logs and dist/dll.js output with html-webpack-plugin v4 and v3. Trace how the plugin handles asset updates during recompilation; done means the refreshed asset is written to dist/dll.js when using v4.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.