rsdoctor icon indicating copy to clipboard operation
rsdoctor copied to clipboard

[Bug]: rsdoctor's server won't be up after build completed when using with tanstack-router plugin

Open YiCChi opened this issue 7 months ago • 6 comments

Version

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700F
    Memory: 14.25 GB / 31.82 GB
  Browsers:
    Edge: Chromium (131.0.2903.99)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @rsdoctor/rspack-plugin: ^1.1.3 => 1.1.3

Details

When using rsdoctor with tanstack-router plugin, server won't be up even if build completed. And when switching to the brief mode, got the following log

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Compiler'
    --- property 'root' closes the circle
    at JSON.stringify (<anonymous>)
    at jsonStrFn (F:\repos\rsdoctor_tanstack-router\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected]_\node_modules\@rsdoctor\sdk\dist\cjs\sdk\sdk\index.js:428:23)
    at RsdoctorSDK.addRsdoctorDataToHTML (F:\repos\rsdoctor_tanstack-router\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected]_\node_modules\@rsdoctor\sdk\dist\cjs\sdk\sdk\index.js:434:65)
    at RsdoctorSDK.inlineScriptsAndStyles (F:\repos\rsdoctor_tanstack-router\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected]_\node_modules\@rsdoctor\sdk\dist\cjs\sdk\sdk\index.js:490:24)
    at RsdoctorSDK.writeStore (F:\repos\rsdoctor_tanstack-router\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected]_\node_modules\@rsdoctor\sdk\dist\cjs\sdk\sdk\index.js:321:19)
    at RsdoctorRspackPlugin.done (F:\repos\rsdoctor_tanstack-router\node_modules\.pnpm\@[email protected]_5c91d83806b51445337071a64418359e\node_modules\@rsdoctor\rspack-plugin\dist\plugin.js:70:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[RSDOCTOR] generated brief report: F:\repos\rsdoctor_tanstack-router\dist\.rsdoctor\rsdoctor-report.html

Everything will be ok after removing tanstack-router plugin.

Reproduce link

https://github.com/YiCChi/rsdoctor_tanstack-router

Reproduce Steps

  1. pnpm build:doctor
  2. open rsbuild.config.ts and delete { mode: "brief" }
  3. pnpm build:doctor

YiCChi avatar Jun 05 '25 18:06 YiCChi

OK,I'll try this.

yifancong avatar Jun 10 '25 03:06 yifancong

Image

Sorry, I couldn't reproduce this issue. Did I do something wrong? I followed the steps above, and didn't encounter the error in the brief.

node: 22, pnpm: 10.11.1

yifancong avatar Jun 10 '25 03:06 yifancong

There has been no reply for too long. It is about to be closed. If there is any problem, you can reply again.

yifancong avatar Jun 18 '25 03:06 yifancong

@easy1090 Sry for the late reply because of my busy work. It looks like your env is mac, and I just tried it on my Mac and found that I could not reproduce this issue either. So maybe this is a windows specific issue? Do u have a windows environment? Maybe you can try it on windows.

YiCChi avatar Jun 18 '25 04:06 YiCChi

@easy1090 Sry for the late reply because of my busy work. It looks like your env is mac, and I just tried it on my Mac and found that I could not reproduce this issue either. So maybe this is a windows specific issue? Do u have a windows environment? Maybe you can try it on windows.

Ok 👌🏻

yifancong avatar Jun 18 '25 06:06 yifancong

After investigation, the reason is that the tanstack package includes the unplugin npm package, which contains rspack/loader/transform.js. The loader’s options include a compiler, which causes a circular reference error when using JSON.stringify. You can temporarily disable this loader, and on my end, I can skip this error.

However, I found that even on Mac, only the builtin loader is analyzed, which is not comprehensive. The issue of incomplete loader analysis needs to be looked into further.

yifancong avatar Jul 18 '25 03:07 yifancong