-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I ran node --inspect-brk -r @swc/register some_script.ts and then opened chrome://inspect - DevTools for Node. Source maps weren't loaded properly (was showing a transpiled JS content under a TS filename). I checked with babel and it works fine. There seems to be a difference between babel and swc that makes it break - I used debugger to dynamically modify swc source maps and managed to see it working.
It looks like embedding full filename path in sources doesn't work in Chrome DevTools for Node. What babel does, and seems to make it work - is encodes directory path in sourceRoot and just filename in sources.
This works (babel):
{
"version": 3,
"sourceRoot": "/Users/pbadenski/workspace/project/",
"sources": [
"test.ts"
],
...
}
This doesn't (swc):
{
"version": 3,
"sources": [
"/Users/pbadenski/workspace/project/test.ts"
],
...
}