How can debug the @next/swc in the vscode
Unanswered
Japanese littleneck posted this in #help-forum
Japanese littleneckOP
What configuration do I need to do

30 Replies
Asian black bear
Like using a debugger to see what is happening inside of the SWC binary code?
Japanese littleneckOP
yep
Is there any good debugging method?
Asian black bear
for like a window with a next.js project nothing really comes to mind.
In general the rust language features should have a debugger, you might need to get the source code and everything though
why do you want to do this?
you can force it to use babel if you put a
.babelrc file, which might be the move if SWC is doing something wrongJapanese littleneckOP
I want to know the “server action compile sectionâ€ï¼ŒI'm very interested in this part,I try to using the lldb do this, but I ran into some lldb debugger configuration issues,So I I want to know what else to do 

Asian black bear
I would probably look more at the SWC side of things than the Next.js side. There must be docs about building/debugging it at the official project: https://github.com/swc-project/swc
Japanese littleneckOP
ok thanks !
Asian black bear
Also, SWC can run on its own without next.js being involved at all. You can just run it like
swc someFile.tssomething like
gdb swc someFile.tsJapanese littleneckOP
Yep
Asian black bear
oof, it seems to always run in napi though, so that gdb command wouldn't work
this article is kind of like what you are doing:
https://medium.com/@a7ul/debugging-nodejs-c-addons-using-vs-code-27e9940fc3ad
https://medium.com/@a7ul/debugging-nodejs-c-addons-using-vs-code-27e9940fc3ad
Also, just downloading the source, finding the afflicted rust code of interest and putting in a bunch of console logging might actually end up being waaaaayyyyy better
Japanese littleneckOP
thanks!
Asian black bear
wouldn't a lot of the stuff about server actions actually be right inside of the Next.js source code, not SWC?
@Asian black bear this article is kind of like what you are doing:
https://medium.com/@a7ul/debugging-nodejs-c-addons-using-vs-code-27e9940fc3ad
Japanese littleneckOP
It not work for me LOL,It's been tried
Asian black bear
yeah doing it with the binary stuff shipped with next or the npm package is probably not going to work
because it won't have debug symbols or anything.
but are you like really sure what you want to know is in SWC?
Why would server actions be compiled any different than any other TS
@Asian black bear wouldn't a lot of the stuff about server actions actually be right inside of the Next.js source code, not SWC?
Japanese littleneckOP
But the next-swc-loader have some logical processing
Asian black bear
and if they are different, wouldn't reversing Babel be way easier?
like Babel is still supported
@Asian black bear like Babel is still supported
Japanese littleneckOP
Maybe, I'll look into it.
Asian black bear
good luck, I hope you find exciting secrets!
Japanese littleneckOP