escodegen
escodegen copied to clipboard
Allow specifying the original name of nodes
See #118, https://github.com/estools/esmangle/issues/85
We can't do this. estree AST nodes are today allowed to have fields other than those specified by estree. Some of those nodes may have an originalName
property that was not meant to cause codegen to behave like this. Additionally, how do you know that the code generator isn't being used to output the minified names?
I think you should start by explaining the problem you have so we can discuss solutions to it.
@michaelficarra The linked issue already explains the problem and essentially proposes this solution: https://github.com/estools/esmangle/issues/85. Without this fix, source maps don't include the original identifiers, and incorrectly include the minified names. This means that for example stack traces will refer to minified function names. With this fix, you can see the original, un-minified function names in the stack trace.
@iBelieve Okay, I think I was misreading this PR. It doesn't change the actual source text generation, just the names used in the source map, is that correct? Can you add tests that Identifier
nodes that have both a name
and an originalName
still codegen using the name
?