Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename contenthash to hashByContent to resolve internal webpack conflict #1034

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/basic.spec.js
Expand Up @@ -630,7 +630,7 @@ describe('HtmlWebpackPlugin', () => {
}, ['<script src="index_bundle.js"'], /test-\S+\.html$/, done);
});

it('will replace [contenthash] in the filename with a content hash of 32 hex characters', done => {
it('will replace [hashByContent] in the filename with a content hash of 32 hex characters', done => {
testHtmlPlugin({
mode: 'production',
entry: {
Expand All @@ -641,7 +641,7 @@ describe('HtmlWebpackPlugin', () => {
filename: '[name]_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({filename: 'index.[contenthash].html'})
new HtmlWebpackPlugin({filename: 'index.[hashByContent].html'})
]
}, [], /index\.[a-f0-9]{32}\.html/, done);
});
Expand Down