Webpack adds hash? to the html file

question: how do I add hash to the template html packaged by webpack? Prevent modified browsers from caching static html resources. The hash property in
HtmlWebpackPlugin sets js. Is there any other way?


does html add hash, to become index.232sad.html? How does your server access this page? Your server may not know the name of your html. Even if you know what the name is, the browser caches the home page and may not send a request to the server at all

if you need to clear the html static resource cache, just tell the browser not to cache the html resource.

like this

ctx.set('Cache-Control', 'no-store')

directly in your webpack configuration, add the hash value
values
index: path.resolve (_ _ dirname,'.. / dist/ index [hash: 5] .html') to the output html file

Menu