How to set the path of introducing html into js in webpack

as shown in the title, if webpack is configured in this way

var htmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");

let pathsToClean = [
    "dist",
];


module.exports = {
    entry: "./src/app.js",
    output: {
        path: __dirname + "/dist",
        filename: "main.[chunkhash].js",
    },
    plugins: [
        new htmlWebpackPlugin({
        template: "./src/footer.html",
        hash: true,
        filename: "footer.html",
        minify: {
            collapseWhitespace: false
        }
    }),
        new CleanWebpackPlugin(pathsToClean),
    ],
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ["style-loader", "css-loader"]
            }
        ]
    }
};

so the final html import file is as follows:

<script type="text/javascript" src="main.95f86be9ceffb45cc1a3.js?ae7b82ac308049d74cc6"></script>

I hope that the last automatically generated html file will be in the format of / static/js/js file. What should I do?

Mar.15,2021

  document  

then should be static/js/js not / static/js/js . They are all under the dist folder and do not require an absolute path.

Menu