boolean | string
true
Configure whether to add a hash value to the filename after the production build.
By default, output file names include a hash value:
dist/static/css/index.7879e19d.css
dist/static/js/index.18a568e5.js
You can set output.filenameHash
to false
to disable this behavior:
export default {
output: {
filenameHash: false,
},
};
After rebuilding, the output filenames become:
dist/static/css/index.css
dist/static/js/index.js
The default hash format is contenthash:8
, which generates an 8-bit hash based on the content of the file.
You can set output.filenameHash
to other formats supported by Rspack and customize the length.
export default {
output: {
filenameHash: 'fullhash:16',
},
};
The optional hash formats are:
fullhash
: The hash value of the entire compilation. If any file changes, the hash values of all output files in the entire project will change.chunkhash
: The hash value of the chunk. The hash value will only change when the content of the chunk (and its included modules) changes.contenthash
: The hash value of the file content. The hash value will only change when the content of the file itself changes.output.filenameHash
.web
, the hash will not be included in the filename of the output files, such as Node.js bundles.