Bug report
What is the current behavior?
Assets with [contenthash] in the filename template do not produce different hashes when changing the value of the output.hashSalt webpack configuration property, if optimization.realContentHash is true.
If the current behavior is a bug, please provide the steps to reproduce.
Create a trivial webpack project with a [contenthash] in the output filename template and optimization.realContentHash set to true.
Vary the value of the output.hashSalt property and observe that emitted filenames don't change.
What is the expected behavior?
Changing the value of output.hashSalt should change the results of all filename hashes.
Inspection of the code here:
|
const hash = createHash(this._hashFunction); |
|
for (const content of assetsContent) { |
|
hash.update(content); |
|
} |
Shows that
RealContentHashPlugin does not look up
outputOptions.hashSalt and apply it to the newly created Hash object.
Other relevant information:
webpack version: 5.75.0
Node.js version: 16.19.1
Operating System: Linux
Additional tools:
Bug report
What is the current behavior?
Assets with
[contenthash]in the filename template do not produce different hashes when changing the value of theoutput.hashSaltwebpack configuration property, ifoptimization.realContentHashistrue.If the current behavior is a bug, please provide the steps to reproduce.
Create a trivial webpack project with a
[contenthash]in the output filename template andoptimization.realContentHashset totrue.Vary the value of the
output.hashSaltproperty and observe that emitted filenames don't change.What is the expected behavior?
Changing the value of
output.hashSaltshould change the results of all filename hashes.Inspection of the code here:
webpack/lib/optimize/RealContentHashPlugin.js
Lines 365 to 368 in b67626c
Shows that
RealContentHashPlugindoes not look upoutputOptions.hashSaltand apply it to the newly created Hash object.Other relevant information:
webpack version: 5.75.0
Node.js version: 16.19.1
Operating System: Linux
Additional tools: