From 253ce305b8028babb174cd01a3b1404b39f79699 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Thu, 30 Apr 2020 16:57:35 +0200 Subject: [PATCH] fix: Prevent "cannot read property info of undefined" when reading meta information from assets --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ad444b49..5c73c3c3 100644 --- a/index.js +++ b/index.js @@ -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); });