Add filename pattern option to allow using contenthash in filenames
See original GitHub issueSince 5.0.0 it’s possible to add [contenthash] etc. to the publicPath.
This allows creation of urls like this:
myweb.tld/assets/[contenthash]/manifest.json`
But this also means that regardless of which file generated by this plugin changed, the hash always changes for all files. Meaning even unchanged files have to be refetched to be cached.
Webpack itself provides filename patterns to allow for file-specific cache busting. E.g:
output: {
filename: '[name].[contenthash].bundle.js',
...
}
It would be great if this could be somehow archived with this plugin as well.
e.g add options for file name generation:
new MiniCssExtractPlugin({
filenamePattern: '[name].[contenthash].[ext]'
})
this would cover all generated filetypes (manifest, images, …) with a single option.
Related issues: #240
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Adding Hashes to Filenames - SurviveJS
According to Steve Souders, attaching the hash to the filename is the most performant option. Setting up hashing#. The build needs tweaking to...
Read more >[Feature] Toggle contenthash for all output filenames #518
When disabled, filenames are untouched. When enabled, the content hash is calculated and injected into all file names ( bundle.js -> bundle.[ ...
Read more >webpack: use hash file name in html template - Stack Overflow
The html-webpack-plugin already handles putting in script tags for you using the correct naming pattern. So you can just omit the script tag...
Read more >Adding Hashes to Filenames | webpack surviveJS
According to Steve Souders , attaching the hash to the filename is the most performant option. # Setting Up Hashing. The build needs...
Read more >Caching - webpack
We can use the output.filename substitutions setting to define the names of our ... The [contenthash] substitution will add a unique hash based...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This results in the same issue as @jthomaschewski mentioned:
I believe what @jthomaschewski wanted was to have the files written using a file pattern:
assets/[name].[contenthash].[ext]I think this should be reopened or am I missing something?