Esprima minification garbles class definitions? #1586
Replies: 2 comments
-
Posted at 2022-01-01 by dirkhillbrecht After playing around a bit, I have discovered, that the problem is directly connected to the "Esprima Mangle" option in the Web IDE: If I disable that option, code is transferred correctly. Could it be that shortening variable names does not handle class definitions correctly? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2022-01-05 by @gfwilliams
That sounds entirely likely. I guess we could report this with Esprima but it feels like it's not very well maintained at the moment :( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2021-12-31 by dirkhillbrecht
I have this source code
When I upload it into the Bangle 2 emulator using the Web IDE, I get "Constructor called" on the console, as expected.
When I upload it with enabled Esprima minification, I get
When I shrink the source code to simply
I see the following error message on uploading the minified code:
To me it seems that the Esprima minificator changes the name of the defined class from "Field" to "a" and then cannot find the class "Field" - which is not too surprising…
Is this expected behaviour? Am I doing something wrong? I'm quite new to Javascript programming but to me the code looks totally reasonable.
Any help appreciated!
Best regards,
Dirk
Beta Was this translation helpful? Give feedback.
All reactions