OptionalentriesA set of options for injected records, where key is the name of the generated entry or chunk and value is a set of link or script attributes.
If not set then only the generated output of the input entries will be inserted without additional attributes.
If tag of an entry is not set then it will be determined based on other attributes and file extension.
OptionalexcludeAn array or set of names of entries to exclude from injection.
OptionalexternalsArrays of additional scripts and links that will be injected to the output HTML document before or after the generated entries and chunks.
Tag is mandatory.
{
before: [{
tag: 'link',
href: 'https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css',
crossorigin: 'use-credentials',
}],
after: [{
tag: 'style',
text: `
body {
margin: 0;
height: calc(100vh - 1px);
display: flex;
}
`,
}, {
tag: 'script',
text: 'console.log("Hello from external code!")',
}],
}
OptionalfaviconA file path of the favicon of the output HTML document. The provided file will be emitted as an asset.
OptionalfileA file name of the resulting HTML document.
⚠️ Mandatory if the RollupHTML2PluginOptions.template option is set to an HTML.
OptionalinjectDefines whether to inject bundled files or not.
If set to false then bundled files are not injected.
If set to "head" or "body" then script tags are injected to
the selected element.
OptionalmetaA set of metadata of the output HTML document. The provided object is
handled as pairs name: content.
OptionalminifyOptions
to pass to the html-minifier.
If the options is undefined or set to false then the output HTML will
not minified.
OptionalonlineA path to append to file references injected. This is useful for putting files on a CDN after building.
A path to an HTML template file or an HTML string.
OptionaltitleSets the title of the output HTML document.
HTML2 Plugin Options