const defaultHtmlPluginOptions ={ inject,// corresponding to the html.inject config favicon,// corresponding to html.favicon config filename,// generated based on output.distPath and entryName template,// defaults to the built-in HTML template path templateParameters,// corresponding to the html.templateParameters configchunks:[entryName],minify:{// generated based on output.disableMinimizeremoveComments:false,useShortDoctype:true,keepClosingSlash:true,collapseWhitespace:true,removeRedundantAttributes:true,removeScriptTypeAttributes:true,removeStyleLinkTypeAttributes:true,removeEmptyAttributes:true, minifyJS,minifyCSS:true,minifyURLs:true,},};
The configs of html-webpack-plugin can be modified through tools.htmlPlugin.
The built-in html-webpack-plugin plugins can be disabled by set tools.htmlPlugin to false. After disabling, Rsbuild will no longer generate HTML files.
By default, Rsbuild will compresses JavaScript/CSS code inside HTML during the production build to improve the page performance. This ability is often helpful when using custom templates or inserting custom scripts.
However, when output.inlineScripts or output.inlineStyles is turned on, inline JavaScript/CSS code will be repeatedly compressed, which will have a certain impact on build performance. You can modify the default minify behavior by modifying the tools.htmlPlugin.minify configuration.