There was actually another thread on this - the easiest way around it is simply to set 'Module Minification' in settings to 'No Minification', and your problems will almost certainly be solved. To be honest when that code was added you couldn't have local modules, so this was less of an issue.
I'd love to have some kind of local minification, but it seems the majority of minifiers use
eval, which is banned in Web Apps... The closure compiler (although rate limited) is also pretty good (constant folding, etc).
Someone was looking into finding a local minifier, but I don't believe they got anything working. If there was something that we knew worked I'd be very happy to add it though.
Good point about the unchanged modules - for now, I'll add a simple 'cache' which should at least make it far less likely that you hit this.
I just filed a bug for this: https://github.com/espruino/EspruinoWebIDE/issues/105
I'm only aware of minifiers/shrinkwrappers written in Java or C/C++. There are reasons for it. (But: ...could a signed Java Applet solve the issue? ...of course a bit an overkill for the term 'Applet') .
In order to continue I pulled the module into the code. Since at development time for components the time (and space) is not as much on the line as at runtime, it worked for me. Having still modules - just not minified - is though already a leap towards a final solution with minification. Adding the cache for now is a very good tactical solution. I assume, the cache stays alive for the duration of a Web IDE session. Btw, for file name and path retention I was thinking about HTML5 storage. And for the cache beyond session I was thinking about a second, parallel modules directory - such as modulesm - that could store the minified version. Because of security I'm sure it would require a pop-up for the save-confirmation from the user, does it? - no pressure what so ever... ;-)
:) Well, the fix is in the GitHub version now - it's just a per-session cache, which I assume will be enough to solve your current issues - although changing the minifier setting should work too. I'm not sure storing the cache between sessions will really help that much - the effort would be much better spent trying to find a minifier that could run offline.
Does anyone know of one?
although changing the minifier setting should work too
I did that... and may have had this side effect:
In Project, I selected No Minification for Module Minification (for Minification it was already set to No Minification), and it did reset / clear the Sandbox directory setting in Communication of the WEB IDE... (added clarification that the Files were not cleared, just the setting in Web IDE).
Is that possible?
Sending code to the board with a reset / cleard / empty Sandbox directory and modules to be expected to found in /sandbox/modules (too), the console shows:
>echo(0); ERROR: Unable to mount SD card : NOT_READY WARNING: Module "XYZMODULE" not found Uncaught Error: Field or method does not already exist, and can't create it on undefined at line 1 col 30 var v = require("XYZMODULE").connect(.....
I can't help you, but for clarification - when you said it reset the sandbox directory, do you mean it forgot what directory the sandbox should be (this seems most likely), or that it actually deleted everything in the sandbox directory?
Having re-entered the Sandbox directory in Communication (to what it was before), the module is found, but now I get another 'nasty' comment / surprise:
>echo(0); ERROR: Out of Memory! WARNING: Unable to create string as not enough memory WARNING: Out of memory while appending to array Execution Interrupted. at line 2 col 60 ...(g-a+1)*(f-d+1)});c.set()}});c.write(1);e.write(1);h.write(0... >
I just wonder why... because it is the very same (in total) amount of 'unmodularized' code when sending from edit pane (...with no module but module code imbedded). It is the code shown in post at http://forum.espruino.com/comments/11899589/, except the first part as module in the /sandbox/modules directory - which worked before (with Module Minification set to Web IDE's default).
I assume the out of memory occurs because the module is not streamed but read as a whole and then sent... could that be? - I tested successfully the module (core code) embedded, so it cannot be some syntax issue.
Clarification: just the Web IDE setting got cleared! Gladly! Otherwise: @#Y@%QWEG%Y... I'm not there yet, but could eventually close in on it... ;-) ...your
Man, I just can't...
related to ...433mhz... is still ringing in my ears... (at http://forum.espruino.com/comments/11897222/)
I find the setting getting cleared unlikely. The code for those settings is auto generated so there is no reason why that should cause you issues.
And yes - modules are loaded as strings and then executed, so chances are there wasn't enough memory for the string. How big is your module file?
Module file is 5335 bytes, including comments - all what you see in post http://forum.espruino.com/comments/11899589/, lines 5..139 with a few more comment lines (frugal doc of methods...).
There was actually another thread on this - the easiest way around it
is simply to set 'Module Minification' in settings to 'No
Minification', and your problems will almost certainly be solved.
Yep, it solves the problem BUT added 800 JSVARS to the program size. (In my application code) By doing so, you just "shot yourself in the foot" by not having minification!
@user7114, when iteratively developing a module as module or with its code 'inline' within a (limited) testbed, no minification can work. But for runtime, where the module should - hopefully - be a 'small' part compared to the application, additional JSVARS are a death sentence.
Developing with no minification in a (limited) testbed though has the advantage of not eating up the budget of the not really free google closure compiler service. At the same time, the testbed is best practice for unit/regression test and documented example.
Best bet is definitely going to be to find an offline whitespace minifier. There should definitely be one around.
As I said in the other thread,
acorn(a parser) is already in the Web IDE, and there should really be a simple minifier that uses that (although I can't find one). It wouldn't take long to write one but it just seems like someone must have done it!
Duplicate of: New-Bee error message: Too many compiles - try back later ? see http://forum.espruino.com/conversations/254197
Doing incremental development using the Web IDE, all of a sudden I get this in the console:
...and nothing goe anymore. A bit very frustrated - because it is on an unchanged module in the local sandbox - I leave the stuff alone.
Googling 'oo many compiles...' leads me to this Google Closure Compiler Service API Reference page: https://developers.google.com/closure/compiler/docs/api-ref
Under the Errors I find:
On the Getting Started with the API at https://developers.google.com/closure/compiler/docs/gettingstarted_api
puts me in the category of an abuser...
It was several hours later when I came back and tried again to no avail - and while stuck - ventured into googling and creating this conversation.
@Gordon, am I wasting my time here?
Is this what I'm thinking it is: Web IDE (with local Sandbox modules) is using a 'free' but limited free Google service?
So my primary question here is: What is the way around this limitation?
And a quite corollary question is: Did I miss that in the documentation of the Web IDE?