This plugin can be used to create HTML files that are associated with Rspack assets.
options
{}
Name | Type | Default | Description |
---|---|---|---|
title | string|undefined | undefined | The title to use for the generated HTML document. |
filename | string | 'index.html' | The file to write the HTML to. Defaults to index.html . You can specify a subdirectory here too (eg: pages/index.html). |
template | string|undefined | undefined | The template file path. |
templateContent | string|undefined | undefined | The template file content, priority is greater than template. |
templateParameters | Record<string, string> | {} | Allows to overwrite the parameters used in the template. |
inject | 'head'|'body'|undefined | undefined | The script and link tag inject position in template . |
publicPath | string | '' | The publicPath used for script and link tags. |
scriptLoading | 'blocking'|'defer'|'module' | 'defer' | Modern browsers support non blocking javascript loading ('defer') to improve the page startup performance. Setting to 'module' adds attribute type='module'. This also implies 'defer', since modules are automatically deferred. |
chunks | string[]|undefined | undefined | Allows you to add only some chunks. |
excludedChunks | string[]|undefined | undefined | Allows you to skip some chunks. |
sri | 'sha256'|'sha384'|'sha512'|undefined | undefined | The sri hash algorithm, disabled by default. |
minify | boolean | false | Controls whether to minify the output. |
favicon | string|undefined | undefined | Adds the given favicon path to the output HTML. |
meta | Record<string, string|Record<string, string>> | {} | Allows to inject meta-tags. |
If the configuration options provided by rspack.HtmlRspackPlugin
cannot meet your needs, you can also directly use the community's html-webpack-plugin plugin.