Webpack HTML Plugin
The html-webpack-plugin is a Webpack plugin that simplifies the creation of HTML files to serve your bundled JavaScript files. It automatically generates an HTML file (or uses a template) and injects your bundled scripts, reducing manual effort.
// webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
devServer: {
port: 8081,
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html'
})
]
};