Rsdoctor is a Rspack build analysis tool. In Modern.js, we recommend using Rsdoctor to diagnose and analyze the build process and build outputs.
npm add @rsdoctor/rspack-plugin -DIn modern.config.ts, you can register the Rspack plugin via tools.bundlerChain. Refer to the example below:
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
export default {
// ...
tools: {
bundlerChain(chain) {
// Only register the plugin when RSDOCTOR is true, as the plugin will increase build time.
if (process.env.RSDOCTOR) {
chain.plugin('rsdoctor').use(RsdoctorRspackPlugin, [
{
// Plugin options
},
]);
}
},
},
};You can execute the build command within your project. After the build is complete, Rsdoctor will automatically open the analysis page for the build.
RSDOCTOR=true npm run buildFor more information, please refer to the Rsdoctor Website.