After the dependency installation, you need to integrate the Rsdoctor plugin into your project. Below are some examples of common tools and frameworks:
Initialize the RsdoctorRspackPlugin in the plugins of rspack.config.js:
rspack.config.js
const{ RsdoctorRspackPlugin }=require('@rsdoctor/rspack-plugin');module.exports ={// ...plugins:[// Only register the plugin when RSDOCTOR is true, as the plugin will increase the build time. process.env.RSDOCTOR&&newRsdoctorRspackPlugin({// plugin options}),].filter(Boolean),};
Options: The plugin provides some configurations, please refer to Options.
Initialize the RsdoctorRspackPlugin in the tools.rspack of rsbuild.config.ts:
rsbuild.config.ts
import{ RsdoctorRspackPlugin }from'@rsdoctor/rspack-plugin';exportdefault{// ...tools:{rspack(config,{ appendPlugins }){// Only register the plugin when RSDOCTOR is true, as the plugin will increase the build time.if(process.env.RSDOCTOR){appendPlugins(newRsdoctorRspackPlugin({// plugin options}),);}},},};
Options: The plugin provides some configurations, please refer to Options.
Initialize the RsdoctorWebpackPlugin in the plugins of webpack.config.js:
webpack.config.js
const{ RsdoctorWebpackPlugin }=require('@rsdoctor/webpack-plugin');module.exports ={// ...plugins:[// Only register the plugin when RSDOCTOR is true, as the plugin will increase the build time. process.env.RSDOCTOR&&newRsdoctorWebpackPlugin({// plugin options}),].filter(Boolean),};
Options: The plugin provides some configurations, please refer to Options.
Initialize the plugin in the tools.rspack of modern.config.ts:
modern.config.ts
import{ RsdoctorRspackPlugin }from'@rsdoctor/rspack-plugin';exportdefault{// ... tools:{rspack(config,{ appendPlugins }){// Only register the plugin when RSDOCTOR is true, as the plugin will increase the build time.if(process.env.RSDOCTOR){appendPlugins(newRsdoctorRspackPlugin({// plugin options}),);}},},};
Options: The plugin provides some configurations, please refer to Options.
TIP
For projects using Modern.js Webpack mode, please register the RsdoctorWebpackPlugin plugin through tools.webpack.