The first is to use the write module to load your module into flash. You can add it as a string, or use the wget method to load it.
Once it is in flash you don't need this loader script.
Then use the flash item method to pull the string from flash and add to the module cache.
In your example you would not use the 2nd require, as the first would have already added it.
The error you are getting is due to the module not getting added to then flash with the write method first, so the retrieved string is empty so the module.add fails
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You need to use the module in 2 stages.
The first is to use the write module to load your module into flash. You can add it as a string, or use the wget method to load it.
Once it is in flash you don't need this loader script.
Then use the flash item method to pull the string from flash and add to the module cache.
In your example you would not use the 2nd require, as the first would have already added it.
The error you are getting is due to the module not getting added to then flash with the write method first, so the retrieved string is empty so the module.add fails