From b8f6ee05f1480deca9881552d0b47bb693e1ce44 Mon Sep 17 00:00:00 2001 From: Eleftherios Pegiadis Date: Mon, 27 Aug 2018 14:12:25 +0300 Subject: [PATCH] Rename contenthash to hashByContent to resolve internal webpack conflict Also updates the test case and comments. This occurs with webpack >= 4.3 --- index.js | 4 ++-- spec/basic.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index d9060862..47f18f71 100644 --- a/index.js +++ b/index.js @@ -239,9 +239,9 @@ class HtmlWebpackPlugin { return self.options.showErrors ? prettyError(err, compiler.context).toHtml() : 'ERROR'; }) .then(html => { - // Allow to use [contenthash] as placeholder for the html-webpack-plugin name + // Allow to use [hashByContent] as placeholder for the html-webpack-plugin name // From https://github.com/webpack-contrib/extract-text-webpack-plugin/blob/8de6558e33487e7606e7cd7cb2adc2cccafef272/src/index.js#L212-L214 - const finalOutputName = self.childCompilationOutputName.replace(/\[(?:(\w+):)?contenthash(?::([a-z]+\d*))?(?::(\d+))?\]/ig, function () { + const finalOutputName = self.childCompilationOutputName.replace(/\[(?:(\w+):)?hashByContent(?::([a-z]+\d*))?(?::(\d+))?\]/ig, function () { return loaderUtils.getHashDigest(html, arguments[1], arguments[2], parseInt(arguments[3], 10)); }); // Replace the compilation result with the evaluated html code diff --git a/spec/basic.spec.js b/spec/basic.spec.js index 8b4f5c49..012901c7 100644 --- a/spec/basic.spec.js +++ b/spec/basic.spec.js @@ -630,7 +630,7 @@ describe('HtmlWebpackPlugin', () => { }, ['