Skip to content

Commit 253ce30

Browse files
committed
fix: Prevent "cannot read property info of undefined" when reading meta information from assets
1 parent ea97fbe commit 253ce30

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,12 @@ class HtmlWebpackPlugin {
581581
// compilation.getAsset was introduced in webpack 4.4.0
582582
// once the support pre webpack 4.4.0 is dropped please
583583
// remove the following guard:
584-
if (!compilation.getAsset) {
584+
const asset = compilation.getAsset && compilation.getAsset(chunkFile);
585+
if (!asset) {
585586
return true;
586587
}
587588
// Prevent hot-module files from beeing included:
588-
const assetMetaInformation = compilation.getAsset(chunkFile).info || {};
589+
const assetMetaInformation = asset.info || {};
589590
return !(assetMetaInformation.hotModuleReplacement || assetMetaInformation.development);
590591
});
591592

0 commit comments

Comments
 (0)