In the IDE - you could try the save on send setting of Direct to Flash (execute at boot)
IMO it would be worth to replace Esprima minification with the recently merged Terser minifier (see https://github.com/espruino/EspruinoTools/pull/80).
@Gordon Another reason to deprecate Esprima (it has all kinds of issues with ES6 code).
@Wilberforce it is merged, it's just not live yet - you should be able to load it manually from GitHub if you want to try it. Before putting it live I want to test the module loading on the main IDE platforms first.
In this case it sounds like Terser is unlikely to help (if the issue really is that everything gets shoved on one line).
I'd suggest turning on
Direct to Flashas Wilberforce suggests. That will automatically split code, but also has the bonus that any function code will be executed direct from flash, saving you a bunch of memory.
Where is the "Direct to Flash" option?
Do you mean "save on send"?
When I do that, I get a deluge of "unable to find or create file" messages.
Is this a problem related to custom board? If so, how do I fix it?
Uncaught Error: Unable to find or create file
at line 5 col 1070
Okay, that was a problem with my build, which I've fixed.
Wow. Save on send is incredible, so much ram savings!
I'm trying to upload a block of code to an Espruino (it's my Espruino Board clone, but it's just a clone of the official Espruino with the D-spec part, so this should happen with normal Espruino board as well). Using the IDE, connected via USB - nothing special.
If I upload my code with No Minification, it uploads fine.
If I use the Closure Compiler, it uploads fine.
If I upload my code with Esprima minification, I get a memory error immediately on uploading it, and not all the code gets saved.
Is there any fix or workaround for this? Something that needs to be fixed in the IDE?
My guess is that it's rolling multiple commands (maybe all of them?) into one line, resulting in the Espruino getting this huge blob of code that it can't handle in one "bite"?
Espruino Web IDE version showing as 0.70.6.