HTML
Rspack can generate HTML files for your application and automatically inject the emitted JavaScript and CSS assets. This is useful for production builds where asset filenames often include content hashes, because the generated HTML will always reference the latest build outputs.
Plugins
Rspack provides two plugin options for generating HTML:
- The built-in
HtmlRspackPluginis optimized for performance and common HTML generation needs. - The community-compatible
HtmlWebpackPluginis suitable when you need broader webpack ecosystem compatibility or features that are not yet implemented byHtmlRspackPlugin.
If you're not sure which plugin to choose, see the comparison between HtmlRspackPlugin and HtmlWebpackPlugin to understand their differences in performance, features, and compatibility.
Built-in HtmlRspackPlugin
HtmlRspackPlugin is a high-performance HTML plugin implemented in Rust, offering significantly better build performance than the HtmlWebpackPlugin, especially when building a large number of HTML files.
For all configuration options, see the plugin documentation.
HtmlWebpackPlugin
Rspack is fully compatible with HtmlWebpackPlugin.
For all configuration options, see the plugin documentation.

