How does webpack package the previous traditional structure?

problem description

/css/demo1.html
/css/index.css
index.html
demo1.html
/js/index.js
/img/bg.jpg
/img/icon.jpg

as above, it is a traditional project structure, and because of the way you need to update the cache, you may need to configure hash, for each file to update the cache when webpack is packaged. But I am rather stupid, not very webpack, here to consult you.

the environmental background of the problems and what methods you have tried

I have written some basic configurations along with other articles, which are basically packaged according to the js entry, because I am not sure whether the structure of webpack is necessary or not.
my current project structure is very scattered, not a single-page application structure, so I have no idea about this structure.

what result do you expect?

add a variety of hash (update the cached version number) to the above structure to update the cache when there are changes to the image, css, js, and html.
may not be very clear, but the goal is to clear the cache and avoid manually adding the version number.

Jun.25,2021

if it's just the version number, why not let the back end give the variable a version number and add it to the introduction of the file that needs to be updated. If you need anything else to pack, you might as well webpack it. At least that's what I did before.

Menu