Description
Version
22.9.0
Platform
Microsoft Windows NT 10.0.22631.0 x64
Subsystem
No response
What steps will reproduce the bug?
With
class JSClass {
static async foo() {
throw new Error("JSClass");
}
}
the stack trace without --enable-source-maps
is
Error: JSClass
at JSClass.foo (file:///C:/Users/mfischer/src/videmo/test/node-bug-enable-source-maps/index.mjs:3:15)
but with --enable-source-maps
it becomes:
Error: JSClass
at Function.foo (C:\Users\mfischer\src\videmo\test\node-bug-enable-source-maps\index.mts:3:11)
The class name is lost somewhere.
I also noticed that the class name is missing even without using --enable-source-maps
when using prototype based inheritance instead of classes and also for napi classes created with napi_define_class
(not included in repro below).
See detailed repro at https://github.com/mika-fischer/node-bug-enable-source-maps
So maybe the issue is not really with enable-source-map-support but that the standard CallSite
serialization accesses some magic property that only works for real JS classes and is missing when using prototype based inheritance or napi_define_class
. And enable-source-maps just uses the public accessors of CallSite
, which don't seem to expose/use this property...
In any case I'm interested in both:
--enable-source-map
should retain the class names- Static methods of classes defined with
napi_define_class
(and preferable also "classes" defined using protoype inheritance) should have the class name (with or without--enable-source-maps
)
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
the stack trace should be
Error: JSClass
at JSClass.foo (C:\Users\mfischer\src\videmo\test\node-bug-enable-source-maps\index.mts:3:11)
What do you see instead?
the stack trace is
Error: JSClass
at Function.foo (C:\Users\mfischer\src\videmo\test\node-bug-enable-source-maps\index.mts:3:11)
Additional information
No response