Skip to content

Commit ecd269c

Browse files
author
Anuj Nair
committed
Ensuring that html webpack plugin hooks are available
1 parent 14aabb3 commit ecd269c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugin.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ class CspHtmlWebpackPlugin {
357357
'CspHtmlWebpackPlugin',
358358
this.processCsp.bind(this)
359359
);
360-
} else {
360+
} else if (
361+
compilation.hooks.htmlWebpackPluginBeforeHtmlGeneration &&
362+
compilation.hooks.htmlWebpackPluginAfterHtmlProcessing
363+
) {
361364
// HTMLWebpackPlugin@3
362365
compilation.hooks.htmlWebpackPluginBeforeHtmlGeneration.tapAsync(
363366
'CspHtmlWebpackPlugin',

0 commit comments

Comments
 (0)