How to export webpack to the project after packaging!

I"d like to know that when packaging with webpack, in order to prevent the cache that exists during browser access from affecting the test results, you can add a hash value (index.xxxxxxxxxxxxx.js) to the output file name. I would like to ask how to easily apply this kind of file to the project (such as the java project).

as far as I understand it, the whole process should be: after the front end is developed, the js file is packaged with webpack, and the packaged file is output to the corresponding resource file directory of the java project, while the html or jsp file of the java project already exists in the view directory of the project.
if only the html file is easy to do, the worst thing is to use the template to automatically generate the file and output it directly to a specific directory together with js. However, in the case of jsp, you can only reference the exported js file manually. But what about the hash value added to this file name? Do you also have to manually write the file name with the hash value every time?

Mar.17,2021

use HTMLWebpackPlugin, just to remove its default output, write a regular match, and inject the

you want using HTMLWebpackPlugin's hook
Menu