File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -574,7 +574,21 @@ class HtmlWebpackPlugin {
574
574
const extensionRegexp = / \. ( c s s | j s | m j s ) ( \? | $ ) / ;
575
575
for ( let i = 0 ; i < entryNames . length ; i ++ ) {
576
576
const entryName = entryNames [ i ] ;
577
- const entryPointFiles = compilation . entrypoints . get ( entryName ) . getFiles ( ) ;
577
+ /** entryPointUnfilteredFiles - also includes hot module update files */
578
+ const entryPointUnfilteredFiles = compilation . entrypoints . get ( entryName ) . getFiles ( ) ;
579
+
580
+ const entryPointFiles = entryPointUnfilteredFiles . filter ( ( chunkFile ) => {
581
+ // compilation.getAsset was introduced in webpack 4.4.0
582
+ // once the support pre webpack 4.4.0 is dropped please
583
+ // remove the following guard:
584
+ if ( ! compilation . getAsset ) {
585
+ return true ;
586
+ }
587
+ // Prevent hot-module files from beeing included:
588
+ const assetMetaInformation = compilation . getAsset ( chunkFile ) . info || { } ;
589
+ return ! ( assetMetaInformation . hotModuleReplacement || assetMetaInformation . development ) ;
590
+ } ) ;
591
+
578
592
// Prepend the publicPath and append the hash depending on the
579
593
// webpack.output.publicPath and hashOptions
580
594
// E.g. bundle.js -> /bundle.js?hash
You can’t perform that action at this time.
0 commit comments