const foo = () => {};
// undefined
foo.name
// "foo"
I ran into a specific bug where this doesn't work for the following case when using babel to target modern versions of node: export const foo = () => {};
Note that's only when the declaration is part of an export (https://github.com/babel/babel/issues/7194).