[Bug]: rsdoctor's server won't be up after build completed when using with tanstack-router plugin
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
- pnpm build:doctor
- open
rsbuild.config.tsand delete{ mode: "brief" } - pnpm build:doctor
OK,I'll try this.
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
There has been no reply for too long. It is about to be closed. If there is any problem, you can reply again.
@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.
@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 👌🏻
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.