web-infra-dev / rsdoctor

A one-stop build analyzer for Rspack and webpack.
https://rsdoctor.dev/
MIT License
447 stars 37 forks source link

[Bug]: Build in webpack + production mode stuck when rsdoctor is enabled. #206

Open pushkargupta9807 opened 8 months ago

pushkargupta9807 commented 8 months ago

Version

System:
    OS: macOS 14.3.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 8.01 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Edge: 122.0.2365.80
    Safari: 17.3.1

Details

Hello, I enabled the rsdoctor/webpack-plugin and triggered a webpack + production build. I can see the live build-analysis ongoing along with the build. However, I do not see the build ever completing and seems like it is stuck forever. FYI, I switched the features to [lite, loader, plugins] to avoid any OOM issues. I also tried by disabling the disableClientServer , but still the build is stuck. I waited for ~2-3 hours for a build which typically takes around 15 minutes to complete.

Its stuck at "52.1% building" as shown in the below image: image

Reproduce link

N/A

Reproduce Steps

enable @rsdoctor/webpack-plugin for a webpack build in production mode.

easy1090 commented 8 months ago

This problem may occur under the construction of super-large projects, because Loader reporting will increase the time. We have expected to rust under rspack next quarter to optimize this problem.

This problem seems to be that the compilation stage is relatively heavy, and a specific case needs to be provided. I don't know if it is convenient to provide it.

After the construction is completed, you can also use @rsdoctor/cli to open the report and provide the loader time-consuming data to see which loaders take more time.

pushkargupta9807 commented 8 months ago

Thank @easy1090 . So is there a way I can create the html report file without enabling the devClientServer and just running the build end to end? If so can you lay out the steps please. Thanks

I have also disabled the clientServer which runs the report realtime .

const { RsdoctorWebpackPlugin } = require("@rsdoctor/webpack-plugin");
webpackConfig.plugins.push(
  new RsdoctorWebpackPlugin({
    disableClientServer: true,
    features: ["loader"],
  })
); 

and I have already set the NODE_OPTIONS: ' --max-old-space-size="65536"'

easy1090 commented 8 months ago

@pushkargupta9807

If the clientServer that runs the report in real-time is disabled, will the report also auto-open?

You can set disableClientServer to true to build without opening the report. After the build is completed, it will be in the build product directory .rsdoctor/manifest.json file. But when you want to open the report, you can use @rsdoctor/cli to open the report without building it: https://rsdoctor.dev/guide/start/cli

npx @rsdoctor/cli analyze --profile [.rsdoctor/manifest filepath]
pushkargupta9807 commented 8 months ago

Thank you @easy1090 . I tried that , but for my current app the build never ends and the manifest.json file is never generated.

I tried to scale down the features as well - as in the above config , but it still gets stuck.

pushkargupta9807 commented 7 months ago

@easy1090 I think it is the loaders analysis which is making the build get stuck after compilation is complete. When I just use other features like [plugins] , the build completes with analysis.

As such I was wondering , do you have any insights so as to what might be causing the loader analysis getting stuck forever ? Any way I can debug the InternalLoaderPlugin below to see see what is causing it to never finish ? Or any other tips

image

Also I observe that the "@rsdoctor/core/plugins" is not present - is that expected? image

easy1090 commented 6 months ago

Also I observe that the "@rsdoctor/core/plugins" is not present - is that expected?

This problem has been fixed #305. You can use the 0.2.0 version, current this version is a beta tag.

the loaders analysis which is making the build get stuck after compilation is complete

This problem is not meet yet. Can you give me your repo , I'll try to check this problem. Or you can give me your webpack.config.js. And whether your project has used Vue?

easy1090 commented 1 month ago

You can try to use this options:

reportCodeType: {
   noCode: true
}

https://rsdoctor.dev/config/options/options#reportcodetype

pushkargupta9807 commented 4 weeks ago

Thank you! will try and let you know.