March 19, 2025

Announcing Rsdoctor 1.0

We are excited to announce the official release of Rsdoctor 1.0!

After a year of development and testing, we are proud to introduce Rsdoctor 1.0 — a build analyzer tailored for the Rspack ecosystem and fully compatible with the webpack ecosystem.

Rsdoctor is committed to being a one-stop, intelligent build analyzer that makes the build process transparent, predictable, and optimizable through visualization and smart analysis, helping development teams precisely identify bottlenecks, optimize performance, and improve engineering quality.

Why Rsdoctor

In the field of build analysis, the community already has some mature tools, such as webpack-bundle-analyzer for visualizing bundles, and Statoscope for comprehensive resource analysis. In addition, speed-measure-webpack-plugin can be used to analyze the execution time of plugins and loaders, and locate build performance bottlenecks.

However, these tools still have some shortcomings, such as lack of detailed display of build details, lack of comprehensive build problem analysis capabilities, incompatibility with Rspack, and lack of build warning scanning capabilities.

In summary, community tools have the following areas for improvement:

  1. Lack of detail: Traditional tools cannot delve into the details and changes of the build process, and to view the compilation details of a loader, developers often need to set breakpoints for step-by-step debugging.
  2. Functional limitations: Current analyser typically only display bundle data, lacking build scanning capabilities, unable to proactively provide optimization suggestions, and do not support custom scanning rules.
  3. Support for Rspack: Existing tools do not fully support Rspack, for example, they cannot analyze Rspack's builtin loader of Rspack.

Birth of Rsdoctor

Based on the above situation, we decided to develop a build analyzer focused on the Rspack ecosystem — Rsdoctor.

We designed an intuitive user interface for Rsdoctor, and Rsdoctor extends the loader profiling capability by combining the advantages of multiple tools to more deeply analyze the loader behavior in the compilation phase, built-in the scanning and detection rules for artifacts and compilation, and supports user custom rules.

Rsdoctor not only supports Rspack and webpack, but also supports all tools and frameworks based on Rspack or webpack, such as: Docusaurus, Rspeedy (Lynx), Storybook, Next.js, Nuxt, Re.Pack, Modern.js, Rsbuild, Rspress and Rslib.

Rsdoctor can be used to:

  • As a build analyzer: Help developers understand every aspect of the build process, and provide detailed compilation and bundle analysis.
  • As an extensible analysis tool: Allow developers to customize analysis rules according to project requirements, and achieve targeted optimization of the build process.

Who is using

Rsdoctor has been widely used within ByteDance, helping developers efficiently analyze and solve various problems in the build process.

Since its open source in 2024, Rsdoctor's npm weekly downloads has exceeded 100k. In the community, Rsdoctor has been integrated into frameworks such as Docusaurus and Lynx. In addition, Rsdoctor has also been adopted by large projects such as Sentry, NocoBase and Grafana.

In the future, Rsdoctor will continue to provide first-class support for all tools in the Rstack (Rspack stack abbreviation) ecosystem:

Typical use cases

Rsdoctor offers a rich set of features, detailed content can be found in the Feature Navigation. Here are some typical use cases that demonstrate how Rsdoctor effectively solves common build problems:

1. "Why is the build speed too slow?"

During the build process, if you find that the compilation speed is too slow, you can use the Loader Timeline to view the time consumption of loader execution, and understand the compilation time consumption of each file by each loader. This way, you can find loaders with excessive time consumption.

2. "Outputs are not as expected?"

During the build, there may be problems where the outputs do not match expectations, such as runtime exceptions or style errors. The Loader Details page of Rsdoctor can help you examine the changes made by the loader to a specific file before and after compilation.

3. "How to split the chunks reasonably?"

We can use the Bundle Analysis page to look at the modules tree of a particular artifact to see what modules the chunk contains, and then use the splitChunks configuration of Rspack to split the chunks appropriately.

4. "How to analyze the reasons for the increase in bundle size?"

When a certain version is launched, if the performance of the online page deteriorates due to the increase in the size of the artifact, you can use the Bundle Diff feature of Rsdoctor to compare the details of the bundles of two commits, as well as the changes in the npm packages they depend on.

5. "Why is a certain module bundled?"

During the build process, if you want to know why a certain module file is bundled into the artifact, you can click on the Module Graph icon behind the module in the Modules tree on the Artifact Analysis page to view the upstream dependency relationship of the module.

What's new in 1.0

🎨 Brand new UI

In version 1.0, we have comprehensively optimized the user interface of Rsdoctor, making it more clear, elegant, and easy to navigate. The new design is dedicated to improving the user experience, making information display more intuitive and efficient.

🚀 Faster analysis

In large projects, enabling Rsdoctor can increase the overall build time. To solve this problem, we rewrote the time-consuming data processing logic in Rsdoctor in Rust, and integrated it into Rspack.

This optimization effectively improves the build analysis performance of Rsdoctor, and reduces the overall analysis time by more than 20%. In the future, we will continue to native more modules to further improve the analysis efficiency.

This optimization can be enabled through the enableNativePlugin option:

new RsdoctorRspackPlugin({
  experiments: {
    enableNativePlugin: true,
  },
});

🔍 Module searching

  • Search Module Capability: In the Bundle Size page, we have added a module search function. Users can quickly locate and view the Assets where the module is located by entering the module name, making it more convenient to analyze the reference relationship and size of the module. Details

🛠️ New scanning rules

  • Duplicate packages detecting: Added a rule for detecting duplicate packages across chunks, which can scan for duplicate packages in different chunks. These duplicate packages may cause redundant code in the build.
  • ECMA version checking: Enhanced the ECMA version detection rule, used to detect incompatible advanced syntax.
new RsdoctorRspackPlugin({
  linter: {
    rules: {
      'ecma-version-check': [
        'Warn',
        {
          ecmaVersion: 2015,
        },
      ],
    },
  },
});

How to use 1.0

  • If you are using any tool or framework based on Rspack or webpack, you can refer to the Quick Start to start using Rsdoctor.
  • If you are using Rsdoctor 0.4 or earlier, please note that 1.0 contains a few incompatible updates:
    • The reportCodeType and reportDir configuration items in the plugin configuration have been moved to output.

Welcome to give a star 🌟 to the Rsdoctor GitHub repository.

Next steps

  • AI powered analysis: The build analysis data collected by Rsdoctor is very rich, but there may be a certain learning curve for new users. Therefore, we will integrate AI capabilities into Rsdoctor to help users quickly extract key information from massive data, provide intelligent optimization suggestions, and reduce the threshold of build analysis.
  • CI proactive monitoring: Rsdoctor will extend its capabilities in CI environments by introducing Rsdoctor CI Action, based on the existing Bundle Diff feature. This will provide automated monitoring of bundle sizes and alerts for performance issues to ensure quality.
  • Further Native: Due to the implementation of Rspack in Rust and the use of a multi-threaded architecture, the current analysis of the built-in loader of Rspack by Rsdoctor is not accurate enough. We plan to optimize the analysis mechanism based on Rspack Native Plugin, and provide more accurate loader performance data and compilation behavior insights.

Finally, thank you to all the developers who have contributed to Rsdoctor ❤️:

@9aoy@bin1357@cairon666@cclap2020@charpeni@chenjiahan@ChuHoMan@cnryb@Gehbt@gezhicui@HigherOrderLogic@iamleniac@inottn@jkzing@KyrieLii@kwonoj@LingyuCoder@nanianlisao@nhducit@NickBolles@nyqykk@puppet-666@SoonIter@sudhakar-s@Timeless0911@tinywaves@trueLoving@wChenonly@zllkjc