Rsdoctor provides the Loader Analysis
module, which mainly provides statistics on Loaders at the directory and file level. It helps you analyze the compilation of folders and individual files by Loaders.
Click on the navigation bar "Compile Analysis" -> "Loader Analysis" option to view the compilation analysis report. Of course, this page will only display the features if the loader
analysis capability is enabled features.
Firstly, in this module, you can directly see the file tree structure of all files processed by Loaders, as shown in the following image:
In the filter search box at the top, you can filter Loaders and search for file names. After entering the name, the file tree dynamically displays the matching files, making it easier to locate the files you want to query.
In the file tree structure below, there are two interactive forms to obtain different data information:
The corresponding details will be explained in the following paragraphs.
By clicking on a selected directory, you can see the time statistics of all Loaders in the selected directory (estimated time consumption) on the right side of the file tree. The content of the "Statistics of xxx" card is shown in the following image:
Here are the main information we can obtain:
Usually, we can select some third-party library directories within node_modules
and then determine whether it is necessary to set module.rule.exclude for this directory based on the Loader's time consumption information. This helps reduce the processing time of common Loaders like babel-loader
.
If it is a third-party library with advanced ES syntax or a package within the workspace, we need to make more granular decisions at the individual file level based on the content in the next paragraph to optimize Loader performance.
By clicking on a file, a modal will appear with the following content:
"Left section": A list of all executed Loaders for the clicked file and the time consumption of each Loader for compiling the file.
"Right section": Information about the input, output, and parameter data of the selected Loader at the time of invocation.
As shown in the image, we can obtain the following information about the target file: