Skip to content

Commit

Permalink
fix: Prevent "cannot read property info of undefined" when reading me…
Browse files Browse the repository at this point in the history
…ta information from assets
  • Loading branch information
jantimon committed Apr 30, 2020
1 parent ea97fbe commit 253ce30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,12 @@ class HtmlWebpackPlugin {
// compilation.getAsset was introduced in webpack 4.4.0
// once the support pre webpack 4.4.0 is dropped please
// remove the following guard:
if (!compilation.getAsset) {
const asset = compilation.getAsset && compilation.getAsset(chunkFile);
if (!asset) {
return true;
}
// Prevent hot-module files from beeing included:
const assetMetaInformation = compilation.getAsset(chunkFile).info || {};
const assetMetaInformation = asset.info || {};
return !(assetMetaInformation.hotModuleReplacement || assetMetaInformation.development);
});

Expand Down

0 comments on commit 253ce30

Please sign in to comment.