Search code examples
webpackwebpack-4html-webpack-plugin

Webpack html-webpack-plugin is not working


When I run the command npm run build, I expect that index.html should be copied into dist as in this tutorial at 10:00: https://www.youtube.com/watch?v=TzdEpgONurw&t=602s

However nothing happens, no warning and no errors. Here's the config:

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.export ={
    mode: 'development',
    module: {
        rules: [
            {
                test: /.html$/,
                use: [
                    {
                        loader: 'html-loader',
                        options: {minimize: true}
                    }
                ]
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html',
            filename:'./index.html'
        }),
    ],
}

Here's my complete code: https://github.com/wickedrahul/webpackFourSetup


Solution

  • As suggested by Grzegorz T, it was a typo. Corrected module.export to module.exports to resolve the issue.