Html-webpack-plugin: HMR multiStep mode is broken in webpack 2

Created on 28 Dec 2016  路  10Comments  路  Source: jantimon/html-webpack-plugin

Currently enabling multiStep mode in HotModuleReplacementPlugin breaks html-webpack-plugin. The page simply won't refresh correctly breaking the system. The fix for this requires an underlying change as discussed below.

To quote @sokra

the hot update chunks are also "chunk assets" and it looks like that the html-plugin generates a script tag for them.
html-plugin should use the new stats.entrypoints data to generate the script tags. This contains all needed files for an entrypoint in correct order.

Here's a quick search against webpack source, but I can't find a definitive plugin example on a quick look.

To keep this backwards compatible we would need some way to check webpack version. A simple way to do that is to go through require('webpack/package.json').version although it would be better if plugins received the version information from webpack (does this happen already?).

Related to #401.

wontfix

Most helpful comment

Is this still being worked on ?

All 10 comments

Could we expose stats.entrypoints also in webpack 1.x?
This would allow us to have a clean upgrade path for plugin relying on it stats.entrypoints in webpack 2.x

stats.entrypoints is webpack 2 only. We added it for your use case. It lists all files required for an entrypoint in the correct order. So you don't have to do the ordering yourself. It's exposed by webpack. You may separate files by filetype (i. e. put styles before scripts).

@sokra Is there any reason not to add stats.entrypoints for webpack 1 ?

Is this still being worked on ?

The problem is:

TypeError: Cannot read property 'source' of undefined.

It occurs here.

Specifically:

  1. the asset is deleted: delete compilation.assets[outputName]
  2. and we try to call a method on a now undefined value: childCompilation.assets[outputName].source()

The problem was introduced quite a while ago: https://github.com/jantimon/html-webpack-plugin/commit/be966e70e093cab483a67017bec9e97f65c09c3d#diff-168726dbe96b3ce427e7fedce31bb0bcR195.

Actually, scratch that. It's the childCompilation that doesn't have the asset, so while the error is the same, it's not caused by the delete that I've mentioned above. Still, it shouldn't be too hard to fix this, should it?

This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.

Here, when changing some js file it realoads the old version

is this fixed on master? or latest version?

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

var-bp picture var-bp  路  3Comments

NeverwinterMoon picture NeverwinterMoon  路  3Comments

mmjamal picture mmjamal  路  3Comments

lonelydatum picture lonelydatum  路  3Comments

ghaiklor picture ghaiklor  路  3Comments