R
R
romaro2021-04-02 17:57:09
webpack
romaro, 2021-04-02 17:57:09

Why doesn't filename work in HtmlWebpackPlugin for Webpack?

Created a minimal build configuration:

const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    context: path.resolve(__dirname, 'source'),
    entry: './entry.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'public'),
    },
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            template: './file.html',
            filename: '[name]-[hash].html'
        }),
    ]
}


I expect that in the / public folder I will have a file file -021d46d31a4a286de108.html. In fact:
6067303c63063949240650.jpeg

Where does the template engine get the value of main from?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question