-
• #2
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?
-
• #3
Could it be that shortening variable names does not handle class definitions correctly?
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 :(
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