Rollup plugin to inject bundled files to an HTML template.
This plugin was inspired by the html-webpack-plugin and rollup-plugin-bundle-html.
rollup-plugin-html2
doesn't list the output directory but gets entries from the
resulting bundle. Also it emits resulting HTML file as an asset so it could be accessed by other plugins.
The plugin can be used alongside the rollup-plugin-favicons.
In this case rollup-plugin-favicons
should be placed before rollup-plugin-html2
in the plugin list.
npm i -D rollup-plugin-html2
// rollup.config.js
import html2 from 'rollup-plugin-html2'
export default {
input: 'index.js',
output: {
dir: 'dist',
format: 'es',
},
plugins: [
html2({
template: 'index.html',
}),
],
}
Read the documentation.