HtmlWebpackPlugin simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every compilation.
This is an external plugin maintained by the community. Install it separately with
npm install --save-dev html-webpack-plugin.Installation
Basic Usage
Configuration
The title to use for the generated HTML document
The file to write the HTML to. Defaults to
index.htmlWebpack require path to a template
Controls asset injection. Options:
true, 'head', 'body', falseControls HTML minification in production mode
Examples
Custom Template
Multiple Pages
Template Example
Create a template filesrc/index.html: