HTML Plugin
Here is the plugin mentioned in the offcial webpack guide.
This plugin aims to create index.html
for PWAs, with good default template built-in, and let you customize with simple configuration.
You can also provide your own templates in the same way you compose apps - JSX and React components.
Installation
Install the plugin with npm:
$ npm i -D html-plugin vhtml
Usage
Add the plugin to webpack config:
+ const HtmlPlugin = require('html-plugin') module.exports = { entry: 'index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' },+ plugins: [+ new HtmlPlugin({+ title: 'My App'+ })+ ] }
This will generate dist/index.html
:
My App
Options
- filename
- title / name
- lang
- themeColor
- manifest
- favicon